Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added API Constants for Staff #115

Merged
merged 6 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
};
Loading