Skip to content

Commit

Permalink
Merge pull request #115 from uwblueprint/prasanna-karthik/api-constan…
Browse files Browse the repository at this point in the history
…ts-staff

Added API Constants for Staff
  • Loading branch information
jeessh authored Oct 25, 2024
2 parents 71bd6c4 + 28c62b2 commit 101285d
Show file tree
Hide file tree
Showing 3 changed files with 145 additions and 0 deletions.
51 changes: 51 additions & 0 deletions frontend/src/APIClients/Mutations/StaffMutations.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import {gql} from "@apollo/client";

Check warning on line 1 in frontend/src/APIClients/Mutations/StaffMutations.ts

View workflow job for this annotation

GitHub Actions / run-lint

Replace `gql` with `·gql·`

export const ADD_STAFF = gql`
mutation AddStaff($staff: CreateStaffDTO!) {

Check warning on line 4 in frontend/src/APIClients/Mutations/StaffMutations.ts

View workflow job for this annotation

GitHub Actions / run-lint

Insert `··`
addStaff(staff: $staff) {
userId

Check warning on line 6 in frontend/src/APIClients/Mutations/StaffMutations.ts

View workflow job for this annotation

GitHub Actions / run-lint

Delete `··`
email

Check warning on line 7 in frontend/src/APIClients/Mutations/StaffMutations.ts

View workflow job for this annotation

GitHub Actions / run-lint

Replace `········` with `······`
phoneNumber

Check warning on line 8 in frontend/src/APIClients/Mutations/StaffMutations.ts

View workflow job for this annotation

GitHub Actions / run-lint

Delete `··`
firstName

Check warning on line 9 in frontend/src/APIClients/Mutations/StaffMutations.ts

View workflow job for this annotation

GitHub Actions / run-lint

Delete `··`
lastName

Check warning on line 10 in frontend/src/APIClients/Mutations/StaffMutations.ts

View workflow job for this annotation

GitHub Actions / run-lint

Replace `········` with `······`
displayName

Check warning on line 11 in frontend/src/APIClients/Mutations/StaffMutations.ts

View workflow job for this annotation

GitHub Actions / run-lint

Delete `··`
profilePictureURL

Check warning on line 12 in frontend/src/APIClients/Mutations/StaffMutations.ts

View workflow job for this annotation

GitHub Actions / run-lint

Delete `··`
isActive

Check warning on line 13 in frontend/src/APIClients/Mutations/StaffMutations.ts

View workflow job for this annotation

GitHub Actions / run-lint

Replace `········` with `······`
isAdmin
}
}
`
;

export const UPDATE_STAFF = gql`
mutation UpdateStaff($userId: userID!, $staff: UpdateStaffDTO!) {
updateStaff(userId: $userId, staff: $staff) {
userId
email
phoneNumber
firstName
lastName
displayName
profilePictureURL
isActive
isAdmin
}
}
`;

export const DELETE_STAFF = gql`
mutation DeleteStaff($userId: ID!) {
deleteStaff(userId: $userId) {
userId
email
phoneNumber
firstName
lastName
displayName
profilePictureURL
isActive
isAdmin
}
}
`;

33 changes: 33 additions & 0 deletions frontend/src/APIClients/Queries/StaffQueries.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import {gql} from "@apollo/client";

export const GET_ALL_STAFF = gql`
query GetAllStaff {
getAllStaff {
userId
email
phoneNumber
firstName
lastName
displayName
profilePictureURL
isActive
isAdmin
}
}
`;

export const GET_STAFF_BY_IDS = gql`
query GetStaffByIds {
getStaffByIds {
userId
email
phoneNumber
firstName
lastName
displayName
profilePictureURL
isActive
isAdmin
}
}
`;
61 changes: 61 additions & 0 deletions frontend/src/APIClients/Types/StaffTypes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
export type UserRequest = {
userId?: string;
email: string;
password: string;
phoneNumber?: string;
firstName: string;
lastName: string;
isAdmin: boolean;
displayName?: string;
profilePictureURL?: string;
isActive: boolean;
};

export type UserRequestID = {
userId: string;
email: string;
password: string;
phoneNumber?: string;
firstName: string;
lastName: string;
isAdmin: boolean;
displayName?: string;
profilePictureURL?: string;
isActive: boolean;
};

export type UserRequestAdd = {
userId?: number;
email: string;
phoneNumber: string;
firstName: string;
lastName: string;
displayName: string;
profilePictureURL?: string;
isActive: boolean;
isAdmin: boolean;
};

export type UserRequestUpdate = {
userId: number;
email?: string;
phoneNumber?: string;
firstName?: string;
lastName?: string;
displayName?: string;
profilePictureURL?: string;
isActive?: boolean;
isAdmin?: boolean;
};

export type UserRequestDelete = {
userId: number;
email?: string;
phoneNumber?: string;
firstName?: string;
lastName?: string;
displayName?: string;
profilePictureURL?: string;
isActive?: boolean;
isAdmin?: boolean;
};

0 comments on commit 101285d

Please sign in to comment.