From 9b811a7bfd14ddaf646f4c095bd7c28dbe2fdb4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Salazar?= <73718835+joshrs23@users.noreply.github.com> Date: Thu, 27 Nov 2025 09:32:52 -0500 Subject: [PATCH] update staff entity schema and crud --- dataconnect/connector/staff/mutations.gql | 68 ++++++++++++++++++++++- dataconnect/connector/staff/queries.gql | 65 +++++++++++++++++++++- dataconnect/schema/staff.gql | 51 ++++++++++++++--- 3 files changed, 172 insertions(+), 12 deletions(-) diff --git a/dataconnect/connector/staff/mutations.gql b/dataconnect/connector/staff/mutations.gql index 5c953451..20d26162 100644 --- a/dataconnect/connector/staff/mutations.gql +++ b/dataconnect/connector/staff/mutations.gql @@ -1,25 +1,87 @@ mutation CreateStaff( $employeeName: String!, $vendorId: UUID, + $vendorName: String, + $manager: String, + $contactNumber: String, $email: String, + $department: StaffDepartment, + $hubLocation: String, + $track: String, $position: String, + $profileType: ProfileType, $employmentType: EmploymentType!, + $english: EnglishLevel, $rating: Float, $reliabilityScore: Int, - $backgroundCheckStatus: BackgroundCheckStatus!, - $certifications: String + $backgroundCheckStatus: BackgroundCheckStatus! ) @auth(level: USER) { staff_insert( data: { employeeName: $employeeName vendorId: $vendorId + vendorName: $vendorName + manager: $manager + contactNumber: $contactNumber email: $email + department: $department + hubLocation: $hubLocation + track: $track position: $position + profileType: $profileType employmentType: $employmentType + english: $english rating: $rating reliabilityScore: $reliabilityScore backgroundCheckStatus: $backgroundCheckStatus - certifications: $certifications } ) } + +mutation UpdateStaff( + $id: UUID!, + $employeeName: String, + $vendorId: UUID, + $vendorName: String, + $manager: String, + $contactNumber: String, + $email: String, + $department: StaffDepartment, + $hubLocation: String, + $track: String, + $position: String, + $profileType: ProfileType, + $employmentType: EmploymentType, + $english: EnglishLevel, + $rating: Float, + $reliabilityScore: Int, + $backgroundCheckStatus: BackgroundCheckStatus +) @auth(level: USER) { + staff_update( + id: $id, + data: { + employeeName: $employeeName + vendorId: $vendorId + vendorName: $vendorName + manager: $manager + contactNumber: $contactNumber + email: $email + department: $department + hubLocation: $hubLocation + track: $track + position: $position + profileType: $profileType + employmentType: $employmentType + english: $english + rating: $rating + reliabilityScore: $reliabilityScore + backgroundCheckStatus: $backgroundCheckStatus + } + ) +} + +mutation DeleteStaff( + $id: UUID! +) @auth(level: USER) { + staff_delete(id: $id) +} diff --git a/dataconnect/connector/staff/queries.gql b/dataconnect/connector/staff/queries.gql index f8c5b272..da35030a 100644 --- a/dataconnect/connector/staff/queries.gql +++ b/dataconnect/connector/staff/queries.gql @@ -3,12 +3,75 @@ query listStaff @auth(level: USER) { id employeeName vendorId + vendorName + manager + contactNumber email + department + hubLocation + track position + profileType employmentType + english + rating + reliabilityScore + backgroundCheckStatus + } +} + +query getStaffById( + $id: UUID! +) @auth(level: USER) { + staff(id: $id) { + id + employeeName + vendorId + vendorName + manager + contactNumber + email + department + hubLocation + track + position + profileType + employmentType + english + rating + reliabilityScore + backgroundCheckStatus + } +} + +query filterStaff( + $employeeName: String, + $vendorId: UUID, + $department: StaffDepartment, + $employmentType: EmploymentType, + $english: EnglishLevel, + $backgroundCheckStatus: BackgroundCheckStatus +) @auth(level: USER) { + staffs( + where: { + employeeName: { eq: $employeeName } + vendorId: { eq: $vendorId } + department: { eq: $department } + employmentType: { eq: $employmentType } + english: { eq: $english } + backgroundCheckStatus: { eq: $backgroundCheckStatus } + } + ) { + id + employeeName + vendorId + vendorName + department + position + employmentType + english rating reliabilityScore backgroundCheckStatus - certifications } } diff --git a/dataconnect/schema/staff.gql b/dataconnect/schema/staff.gql index fec7f725..3a0bab4e 100644 --- a/dataconnect/schema/staff.gql +++ b/dataconnect/schema/staff.gql @@ -2,7 +2,34 @@ enum EmploymentType { FULL_TIME PART_TIME ON_CALL - CONTRACT + WEEKENDS + SPECIFIC_DAYS + SEASONAL + MEDICAL_LEAVE +} + +enum StaffDepartment { + OPERATIONS + SALES + HR + FINANCE + IT + MARKETING + CUSTOMER_SERVICE + LOGISTICS +} + +enum ProfileType { + SKILLED + BEGINNER + CROSS_TRAINED +} + +enum EnglishLevel { + FLUENT + INTERMEDIATE + BASIC + NONE } enum BackgroundCheckStatus { @@ -10,20 +37,28 @@ enum BackgroundCheckStatus { CLEARED FAILED EXPIRED + NOT_REQUIRED } type Staff @table(name: "staffs") { id: UUID! @default(expr: "uuidV4()") - employeeName: String! - vendorId: UUID + employeeName: String! + vendorId: UUID # vendor_id (FK lógica a Vendor.id) + vendorName: String + manager: String + contactNumber: String email: String - position: String - employmentType: EmploymentType! + department: StaffDepartment + hubLocation: String + track: String + position: String + profileType: ProfileType + employmentType: EmploymentType! + english: EnglishLevel rating: Float reliabilityScore: Int - backgroundCheckStatus: BackgroundCheckStatus! - certifications: String + backgroundCheckStatus: BackgroundCheckStatus! # background_check_status createdDate: Timestamp @default(expr: "request.time") updatedDate: Timestamp @default(expr: "request.time") - createdBy: String @default(expr: "auth.uid") + createdBy: String @default(expr: "auth.uid") }