-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: create interface and types for resident (#18)
* feat: create interface and types for resident * fix: add newline to end of file * addressing PR comments - minor changes to resident interface * feat: create residentResolvers, file for impl * add notification and notification_user models (#17) * feat: create impl file, add prisma client * Updates to Resident Service and Types * feat: add logging for errors * feat: create interface and types for resident * fix: add newline to end of file * addressing PR comments - minor changes to resident interface * feat: create residentResolvers, file for impl * feat: create impl file, add prisma client * Updates to Resident Service and Types * feat: add logging for errors * fix: remove duplicate declarations * feat: add neon db (#21) * feat: add neon db * fix: add optional neon setup * feat: add logging for errors * upgrade: node and ts dependancies * feat: fix linting and add schema mapping * fix: recurrence freq naming * Add graph ql custom scalar data types * Update Eslinting modules * fix: address PR comments --------- Co-authored-by: Selena Zhang <[email protected]> Co-authored-by: Danie1T <[email protected]> Co-authored-by: Sharujan Sreekaran <[email protected]> Co-authored-by: William Tran <[email protected]> Co-authored-by: William Tran <[email protected]>
- Loading branch information
1 parent
bf2318c
commit 7841fb1
Showing
14 changed files
with
633 additions
and
128 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
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 |
---|---|---|
@@ -1 +1 @@ | ||
v18.16.0 | ||
v18.18.2 |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM node:18.16.0-slim | ||
FROM node:18.18.2-slim | ||
|
||
RUN apt-get update -y | ||
RUN apt-get install -y openssl | ||
|
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,54 @@ | ||
import ResidentService from "../../services/implementations/residentService"; | ||
import type { | ||
IResidentService, | ||
ResidentDTO, | ||
CreateResidentDTO, | ||
UpdateResidentDTO, | ||
} from "../../services/interfaces/residentService"; | ||
|
||
const residentService: IResidentService = new ResidentService(); | ||
// const authService: IAuthService = new AuthService(userService, emailService); | ||
|
||
const residentResolvers = { | ||
Query: { | ||
residentsById: async ( | ||
_parent: undefined, | ||
{ id }: { id: string[] }, | ||
): Promise<Array<ResidentDTO>> => { | ||
return residentService.getResidentsById(id.map(Number)); | ||
}, | ||
allResidents: async (): Promise<Array<ResidentDTO>> => { | ||
return residentService.getAllResidents(); | ||
}, | ||
}, | ||
Mutation: { | ||
addResident: async ( | ||
_parent: undefined, | ||
{ resident }: { resident: CreateResidentDTO }, | ||
): Promise<ResidentDTO> => { | ||
const newResident = await residentService.addResident(resident); | ||
return newResident; | ||
}, | ||
updateResident: async ( | ||
_parent: undefined, | ||
{ id, resident }: { id: string; resident: UpdateResidentDTO }, | ||
): Promise<ResidentDTO> => { | ||
const newResident = await residentService.updateResident( | ||
parseInt(id, 10), | ||
resident, | ||
); | ||
return newResident; | ||
}, | ||
deleteResident: async ( | ||
_parent: undefined, | ||
{ id }: { id: string }, | ||
): Promise<ResidentDTO> => { | ||
const deletedResident = await residentService.deleteResident( | ||
parseInt(id, 10), | ||
); | ||
return deletedResident; | ||
}, | ||
}, | ||
}; | ||
|
||
export default residentResolvers; |
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,57 @@ | ||
import { gql } from "apollo-server-express"; | ||
|
||
// TODO: Look into custom types for dates and date time types | ||
|
||
const residentType = gql` | ||
type ResidentDTO { | ||
id: ID! | ||
firstName: String! | ||
lastName: String! | ||
email: String! | ||
phoneNumber: String | ||
displayName: String! | ||
profilePictureLink: String | ||
birthdate: Date | ||
credits: Float | ||
dateJoined: DateTime! | ||
dateLeft: DateTime | ||
} | ||
input CreateResidentDTO { | ||
firstName: String! | ||
lastName: String! | ||
email: String! | ||
phoneNumber: String | ||
displayName: String! | ||
profilePictureLink: String | ||
birthdate: Date | ||
credits: Float | ||
dateJoined: DateTime! | ||
} | ||
input UpdateResidentDTO { | ||
firstName: String | ||
lastName: String | ||
email: String | ||
phoneNumber: String | ||
displayName: String | ||
profilePictureLink: String | ||
birthdate: Date | ||
credits: Float | ||
dateJoined: DateTime | ||
dateLeft: DateTime | ||
} | ||
extend type Query { | ||
residentsById(id: [ID!]): [ResidentDTO!] | ||
allResidents: [ResidentDTO!] | ||
} | ||
extend type Mutation { | ||
updateResident(id: ID!, resident: UpdateResidentDTO!): ResidentDTO! | ||
addResident(resident: CreateResidentDTO!): ResidentDTO! | ||
deleteResident(id: ID!): ResidentDTO! | ||
} | ||
`; | ||
|
||
export default residentType; |
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
Oops, something went wrong.