update staff entity schema and crud

This commit is contained in:
José Salazar
2025-11-27 09:32:52 -05:00
parent f76e93df22
commit 9b811a7bfd
3 changed files with 172 additions and 12 deletions

View File

@@ -1,25 +1,87 @@
mutation CreateStaff( mutation CreateStaff(
$employeeName: String!, $employeeName: String!,
$vendorId: UUID, $vendorId: UUID,
$vendorName: String,
$manager: String,
$contactNumber: String,
$email: String, $email: String,
$department: StaffDepartment,
$hubLocation: String,
$track: String,
$position: String, $position: String,
$profileType: ProfileType,
$employmentType: EmploymentType!, $employmentType: EmploymentType!,
$english: EnglishLevel,
$rating: Float, $rating: Float,
$reliabilityScore: Int, $reliabilityScore: Int,
$backgroundCheckStatus: BackgroundCheckStatus!, $backgroundCheckStatus: BackgroundCheckStatus!
$certifications: String
) @auth(level: USER) { ) @auth(level: USER) {
staff_insert( staff_insert(
data: { data: {
employeeName: $employeeName employeeName: $employeeName
vendorId: $vendorId vendorId: $vendorId
vendorName: $vendorName
manager: $manager
contactNumber: $contactNumber
email: $email email: $email
department: $department
hubLocation: $hubLocation
track: $track
position: $position position: $position
profileType: $profileType
employmentType: $employmentType employmentType: $employmentType
english: $english
rating: $rating rating: $rating
reliabilityScore: $reliabilityScore reliabilityScore: $reliabilityScore
backgroundCheckStatus: $backgroundCheckStatus 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)
}

View File

@@ -3,12 +3,75 @@ query listStaff @auth(level: USER) {
id id
employeeName employeeName
vendorId vendorId
vendorName
manager
contactNumber
email email
department
hubLocation
track
position position
profileType
employmentType 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 rating
reliabilityScore reliabilityScore
backgroundCheckStatus backgroundCheckStatus
certifications
} }
} }

View File

@@ -2,7 +2,34 @@ enum EmploymentType {
FULL_TIME FULL_TIME
PART_TIME PART_TIME
ON_CALL 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 { enum BackgroundCheckStatus {
@@ -10,20 +37,28 @@ enum BackgroundCheckStatus {
CLEARED CLEARED
FAILED FAILED
EXPIRED EXPIRED
NOT_REQUIRED
} }
type Staff @table(name: "staffs") { type Staff @table(name: "staffs") {
id: UUID! @default(expr: "uuidV4()") id: UUID! @default(expr: "uuidV4()")
employeeName: String! employeeName: String!
vendorId: UUID vendorId: UUID # vendor_id (FK lógica a Vendor.id)
vendorName: String
manager: String
contactNumber: String
email: String email: String
position: String department: StaffDepartment
employmentType: EmploymentType! hubLocation: String
track: String
position: String
profileType: ProfileType
employmentType: EmploymentType!
english: EnglishLevel
rating: Float rating: Float
reliabilityScore: Int reliabilityScore: Int
backgroundCheckStatus: BackgroundCheckStatus! backgroundCheckStatus: BackgroundCheckStatus! # background_check_status
certifications: String
createdDate: Timestamp @default(expr: "request.time") createdDate: Timestamp @default(expr: "request.time")
updatedDate: Timestamp @default(expr: "request.time") updatedDate: Timestamp @default(expr: "request.time")
createdBy: String @default(expr: "auth.uid") createdBy: String @default(expr: "auth.uid")
} }