Skip to content

Commit

Permalink
#2998-upated endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
caiodasilva2005 committed Dec 12, 2024
1 parent b4e3cc5 commit da6e24f
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 57 deletions.
4 changes: 2 additions & 2 deletions src/backend/src/controllers/users.controllers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,9 @@ export default class UsersController {
const { organization } = req;

const unreadNotifications = await UsersService.getUserUnreadNotifications(userId, organization);
return res.status(200).json(unreadNotifications);
res.status(200).json(unreadNotifications);
} catch (error: unknown) {
return next(error);
next(error);
}
}
}

This file was deleted.

3 changes: 3 additions & 0 deletions src/backend/src/prisma/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import { writeFileSync } from 'fs';
import WorkPackageTemplatesService from '../services/work-package-template.services';
import RecruitmentServices from '../services/recruitment.services';
import OrganizationsService from '../services/organizations.services';
import NotificationsService from '../services/notifications.services';

const prisma = new PrismaClient();

Expand Down Expand Up @@ -1893,6 +1894,8 @@ const performSeed: () => Promise<void> = async () => {
await RecruitmentServices.createFaq(batman, 'When was FinishLine created?', 'FinishLine was created in 2019', ner);

await RecruitmentServices.createFaq(batman, 'How many developers are working on FinishLine?', '178 as of 2024', ner);

await NotificationsService.sendNotifcationToUsers('Admin!', 'star', [thomasEmrax.userId], ner.organizationId);
};

performSeed()
Expand Down
2 changes: 1 addition & 1 deletion src/backend/src/services/users.services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import authenticatedUserTransformer from '../transformers/auth-user.transformer'
import { getTaskQueryArgs } from '../prisma-query-args/tasks.query-args';
import taskTransformer from '../transformers/tasks.transformer';
import { getNotificationQueryArgs } from '../prisma-query-args/notifications.query-args';
import notificationTransformer from '../transformers/notification.transformer';
import notificationTransformer from '../transformers/notifications.transformer';

export default class UsersService {
/**
Expand Down
6 changes: 3 additions & 3 deletions src/backend/tests/unmocked/users.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { createTestOrganization, createTestTask, createTestUser, resetUsers } fr
import { batmanAppAdmin } from '../test-data/users.test-data';
import UsersService from '../../src/services/users.services';
import { NotFoundException } from '../../src/utils/errors.utils';
import { sendNotificationToUsers } from '../../src/utils/homepage-notifications.utils';
import NotificationsService from '../../src/services/notifications.services';

describe('User Tests', () => {
let orgId: string;
Expand Down Expand Up @@ -59,8 +59,8 @@ describe('User Tests', () => {

it('Succeeds and gets user notifications', async () => {
const testBatman = await createTestUser(batmanAppAdmin, orgId);
await sendNotificationToUsers([testBatman.userId], 'test1', 'test1', orgId);
await sendNotificationToUsers([testBatman.userId], 'test2', 'test2', orgId);
await NotificationsService.sendNotifcationToUsers('test1', 'test1', [testBatman.userId], orgId);
await NotificationsService.sendNotifcationToUsers('test2', 'test2', [testBatman.userId], orgId);

const notifications = await UsersService.getUserUnreadNotifications(testBatman.userId, organization);

Expand Down

0 comments on commit da6e24f

Please sign in to comment.