-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#3074-created get unread announcements endpoint
- Loading branch information
1 parent
bc93cf1
commit 2f337d9
Showing
9 changed files
with
83 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/backend/src/prisma-query-args/announcements.query.args.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Prisma } from '@prisma/client'; | ||
import { getUserQueryArgs } from './user.query-args'; | ||
|
||
export type AnnouncementQueryArgs = ReturnType<typeof getAnnouncementQueryArgs>; | ||
|
||
export const getAnnouncementQueryArgs = (organizationId: string) => | ||
Prisma.validator<Prisma.AnnouncementDefaultArgs>()({ | ||
include: { | ||
usersReceived: getUserQueryArgs(organizationId), | ||
userCreated: getUserQueryArgs(organizationId) | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Prisma } from '@prisma/client'; | ||
import { AnnouncementQueryArgs } from '../prisma-query-args/announcements.query.args'; | ||
import { Announcement } from 'shared'; | ||
import { userTransformer } from './user.transformer'; | ||
|
||
const announcementTransformer = (announcement: Prisma.AnnouncementGetPayload<AnnouncementQueryArgs>): Announcement => { | ||
return { | ||
announcementId: announcement.announcementId, | ||
text: announcement.text, | ||
dateCreated: announcement.dateCreated, | ||
userCreated: userTransformer(announcement.userCreated), | ||
slackEventId: announcement.slackEventId, | ||
slackChannelName: announcement.slackChannelName | ||
}; | ||
}; | ||
|
||
export default announcementTransformer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { User } from './user-types'; | ||
|
||
export interface Announcement { | ||
announcementId: string; | ||
text: string; | ||
userCreated: User; | ||
dateCreated: Date; | ||
slackEventId: string; | ||
slackChannelName: string; | ||
} |