Merge branch 'dev' of https://github.com/Oloodi/krow-workforce into feature/session-persistence-new

This commit is contained in:
2026-03-19 10:27:42 +05:30
190 changed files with 4827 additions and 196 deletions

View File

@@ -0,0 +1,38 @@
enum BreakDuration {
MIN_10
MIN_15
MIN_30
MIN_45
MIN_60
NO_BREAK
}
#this is position, timesheet and schedule in staff app
type ShiftRole @table(name: "shift_roles", key: ["shiftId", "roleId"]) {
id: UUID! @default(expr: "uuidV4()")
shiftId: UUID!
shift: Shift! @ref(fields: "shiftId", references: "id")
roleId: UUID!
role: Role! @ref(fields: "roleId", references: "id")
# demand / requirements
count: Int!
assigned: Int @default(expr: "0")
startTime: Timestamp
endTime: Timestamp
hours: Float
department: String
uniform: String
breakType: BreakDuration
isBreakPaid: Boolean @default(expr: "false")
totalValue: Float
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
}

View File

@@ -0,0 +1,17 @@
type VendorBenefitPlan @table(name: "vendor_benefit_plans") {
id: UUID! @default(expr: "uuidV4()")
vendorId: UUID!
vendor: Vendor! @ref(fields: "vendorId", references: "id")
title: String!
description: String
requestLabel: String
total: Int
isActive: Boolean @default(expr: "true")
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String
}

View File

@@ -0,0 +1,20 @@
enum AccountType {
CHECKING
SAVINGS
}
type Account @table(name: "accounts") {
id: UUID! @default(expr: "uuidV4()")
bank: String!
type: AccountType!
last4: String!
isPrimary: Boolean
accountNumber: String
routeNumber: String
ownerId: UUID! #staff/business
expiryTime: Timestamp
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String
}

View File

@@ -0,0 +1,39 @@
enum ActivityIconType {
INVOICE
CHECK
ALERT
MESSAGE
CALENDAR
}
enum ActivityType {
ORDER_CREATED
SHIFT_UPDATE
COMPLIANCE_ALERT
MESSAGE_RECEIVED
SYSTEM_UPDATE
}
type ActivityLog @table(name: "activity_logs") {
id: UUID! @default(expr: "uuidV4()")
userId: String!
#app
date: Timestamp!
hourStart: String
hourEnd: String
totalhours: String
iconType: ActivityIconType
iconColor: String
#web
title: String!
description: String!
isRead: Boolean @default(expr: "false")
activityType: ActivityType!
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String
}

View File

@@ -0,0 +1,42 @@
enum ApplicationStatus {
PENDING
REJECTED
CONFIRMED
CHECKED_IN
CHECKED_OUT
LATE
NO_SHOW
COMPLETED
}
enum ApplicationOrigin {
STAFF
EMPLOYER #like vendor
}
#position
type Application @table(name: "applications") {
id: UUID! @default(expr: "uuidV4()")
shiftId: UUID!
shift: Shift! @ref(fields: "shiftId", references: "id")
staffId: UUID!
staff: Staff! @ref(fields: "staffId", references: "id")
roleId: UUID!
shiftRole: ShiftRole! @ref(
fields: ["shiftId", "roleId"],
references: ["shiftId", "roleId"]
)
status: ApplicationStatus!
appliedAt: Timestamp @default(expr: "request.time")
checkInTime: Timestamp
checkOutTime: Timestamp
origin: ApplicationOrigin!
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String
}

View File

@@ -0,0 +1,46 @@
enum AssignmentStatus {
PENDING
CONFIRMED
OPEN
COMPLETED
CANCELED
ACTIVE
}
type Assignment @table(name: "assignments") {
id: UUID! @default(expr: "uuidV4()")
# Who is doing the assignment
workforceId: UUID!
workforce: Workforce! @ref(fields: "workforceId", references: "id")
# What exact shift + role this assignment is for
roleId: UUID!
shiftId: UUID!
shiftRole: ShiftRole! @ref(
fields: ["shiftId", "roleId"],
references: ["shiftId", "roleId"]
)
# --- task info ---
title: String
description: String
instructions: String
status: AssignmentStatus @default(expr: "'PENDING'")
# flags / perks
tipsAvailable: Boolean
travelTime: Boolean
mealProvided: Boolean
parkingAvailable: Boolean
gasCompensation: Boolean
# Optional managers list (still ok as json)
managers: [Any!]
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String @default(expr: "auth.uid")
}

View File

@@ -0,0 +1,15 @@
type AttireOption @table(name: "attire_options") {
id: UUID! @default(expr: "uuidV4()")
itemId: String!
label: String!
description: String
imageUrl: String
isMandatory: Boolean
# Relations / ownership
vendorId: UUID
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String
}

View File

@@ -0,0 +1,17 @@
type BenefitsData
@table(name: "benefits_data", key: ["staffId", "vendorBenefitPlanId"]) {
id: UUID! @default(expr: "uuidV4()")
vendorBenefitPlanId: UUID!
vendorBenefitPlan: VendorBenefitPlan!
@ref(fields: "vendorBenefitPlanId", references: "id")
current: Int!
staffId: UUID!
staff: Staff! @ref(fields: "staffId", references: "id")
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String
}

View File

@@ -0,0 +1,63 @@
enum BusinessArea {
BAY_AREA
SOUTHERN_CALIFORNIA
NORTHERN_CALIFORNIA
CENTRAL_VALLEY
OTHER
}
enum BusinessSector {
BON_APPETIT
EUREST
ARAMARK
EPICUREAN_GROUP
CHARTWELLS
OTHER
}
enum BusinessRateGroup {
STANDARD
PREMIUM
ENTERPRISE
CUSTOM
}
enum BusinessStatus {
ACTIVE
INACTIVE
PENDING
}
type Business @table(name: "businesses") {
id: UUID! @default(expr: "uuidV4()")
businessName: String!
contactName: String
userId: String!
companyLogoUrl: String
phone: String
email: String
hubBuilding: String
address: String
placeId: String
latitude: Float
longitude: Float
city: String
state: String
street: String
country: String
zipCode: String
area: BusinessArea
sector: BusinessSector
rateGroup: BusinessRateGroup!
status: BusinessStatus!
notes: String
# --- TIMESTAMPS ---
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String
}

View File

@@ -0,0 +1,10 @@
#courses categories
type Category @table(name: "categories") {
id: UUID! @default(expr: "uuidV4()")
categoryId: String!
label: String!
icon: String
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String
}

View File

@@ -0,0 +1,55 @@
enum ComplianceType {
BACKGROUND_CHECK
FOOD_HANDLER
RBS
LEGAL
OPERATIONAL
SAFETY
TRAINING
LICENSE
OTHER
}
enum CertificateStatus {
CURRENT
EXPIRING_SOON
COMPLETED
PENDING
EXPIRED
EXPIRING
NOT_STARTED
}
enum ValidationStatus {
APPROVED
PENDING_EXPERT_REVIEW
REJECTED
AI_VERIFIED
AI_FLAGGED
MANUAL_REVIEW_NEEDED
}
type Certificate @table(name: "certificates", key: ["staffId", "certificationType"]) {
id: UUID! @default(expr: "uuidV4()")
name: String!
description: String
expiry: Timestamp
status: CertificateStatus!
fileUrl: String
icon: String
certificationType: ComplianceType!
issuer: String #Issuing Authority
certificateNumber: String
validationStatus: ValidationStatus
verificationId: String
staffId: UUID!
staff: Staff! @ref(fields: "staffId", references: "id")
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String
}

View File

@@ -0,0 +1,17 @@
type ClientFeedback @table(name: "client_feedbacks") {
id: UUID! @default(expr: "uuidV4()")
businessId: UUID!
business: Business! @ref(fields: "businessId", references: "id")
vendorId: UUID!
vendor: Vendor! @ref(fields: "vendorId", references: "id")
rating: Int
comment: String
date: Timestamp
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String
}

View File

@@ -0,0 +1,29 @@
enum ConversationStatus {
ACTIVE
}
enum ConversationType {
CLIENT_VENDOR
GROUP_STAFF
STAFF_CLIENT
STAFF_ADMIN
VENDOR_ADMIN
CLIENT_ADMIN
GROUP_ORDER_STAFF
}
type Conversation @table(name: "conversations") {
id: UUID! @default(expr: "uuidV4()")
subject: String
status: ConversationStatus
conversationType: ConversationType
isGroup: Boolean
groupName: String
lastMessage: String
lastMessageAt: Timestamp #lastTime
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String
}

View File

@@ -0,0 +1,9 @@
type CostCenter @table(name: "cost_centers") {
id: UUID! @default(expr: "uuidV4()")
name: String!
businessId: UUID!
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String
}

View File

@@ -0,0 +1,18 @@
type Course @table(name: "courses") {
id: UUID! @default(expr: "uuidV4()")
title: String
description: String
thumbnailUrl: String
durationMinutes: Int
xpReward: Int
categoryId: UUID!
category: Category! @ref(fields: "categoryId", references: "id")
levelRequired: String
isCertification: Boolean
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String
}

View File

@@ -0,0 +1,10 @@
type CustomRateCard @table(name: "custom_rate_cards") {
id: UUID! @default(expr: "uuidV4()")
name: String!
baseBook: String
discount: Float
isDefault: Boolean
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String
}

View File

@@ -0,0 +1,21 @@
enum DocumentType {
W4_FORM
I9_FORM
STATE_TAX_FORM
DIRECT_DEPOSIT
ID_COPY
SSN_CARD
WORK_PERMIT
}
type Document @table(name: "documents") {
id: UUID! @default(expr: "uuidV4()")
name: String!
description: String
documentType: DocumentType!
isMandatory: Boolean @default(expr: "false")
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String
}

View File

@@ -0,0 +1,17 @@
enum RelationshipType {
FAMILY
SPOUSE
FRIEND
OTHER
}
type EmergencyContact @table(name: "emergecyContacts") {
id: UUID! @default(expr: "uuidV4()")
name: String!
phone: String!
relationship: RelationshipType!
staffId: UUID!
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String
}

View File

@@ -0,0 +1,8 @@
type FaqData @table(name: "faq_data") {
id: UUID! @default(expr: "uuidV4()")
category: String!
questions: [Any!]
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String
}

View File

@@ -0,0 +1,63 @@
enum InvoiceStatus {
PAID
PENDING
OVERDUE
PENDING_REVIEW
APPROVED
DISPUTED
DRAFT
}
enum InovicePaymentTerms{
NET_30
NET_45
NET_60
}
type Invoice @table(name: "invoices") {
id: UUID! @default(expr: "uuidV4()")
status: InvoiceStatus!
#vendor poner companyName
vendorId: UUID!
vendor: Vendor! @ref(fields: "vendorId", references: "id")
#businnes poner businessName
businessId: UUID!
business: Business! @ref(fields: "businessId", references: "id")
#order poner eventName
orderId: UUID!
order: Order! @ref(fields: "orderId", references: "id")
shiftId: UUID
shift: Shift @ref(fields: "shiftId", references: "id")
#web
paymentTerms: InovicePaymentTerms
invoiceNumber: String!
issueDate: Timestamp!
dueDate: Timestamp!
hub: String
managerName: String
vendorNumber: String
roles: Any #here is for staff
charges: Any
otherCharges: Float
subtotal: Float
amount: Float!
notes: String
staffCount: Int
chargesCount: Int
#DISPUTED
disputedItems: Any @col(dataType: "jsonb")
disputeReason: String
disputeDetails: String
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String
}

View File

@@ -0,0 +1,47 @@
enum InovicePaymentTermsTemp{
NET_30
NET_45
NET_60
}
type InvoiceTemplate @table(name: "invoice_templates") {
id: UUID! @default(expr: "uuidV4()")
name: String!
ownerId: UUID!#vendor/business
#vendor poner companyName
vendorId: UUID
vendor: Vendor @ref(fields: "vendorId", references: "id")
#businnes poner businessName
businessId: UUID
business: Business @ref(fields: "businessId", references: "id")
#order poner eventName
orderId: UUID
order: Order @ref(fields: "orderId", references: "id")
#web
paymentTerms: InovicePaymentTermsTemp
invoiceNumber: String
issueDate: Timestamp
dueDate: Timestamp
hub: String
managerName: String
vendorNumber: String
roles: Any #here is for staff
charges: Any
otherCharges: Float
subtotal: Float
amount: Float
notes: String
staffCount: Int
chargesCount: Int
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String
}

View File

@@ -0,0 +1,10 @@
type Level @table(name: "levels") {
id: UUID! @default(expr: "uuidV4()")
name: String!
xpRequired: Int!
icon: String
colors: Any
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String
}

View File

@@ -0,0 +1,13 @@
type MemberTask @table(name: "member_tasks", key: ["teamMemberId", "taskId"]) {
id: UUID! @default(expr: "uuidV4()")
teamMemberId: UUID!
teamMember: TeamMember! @ref(fields: "teamMemberId", references: "id")
taskId: UUID!
task: Task! @ref(fields: "taskId", references: "id")
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
}

View File

@@ -0,0 +1,16 @@
type Message @table(name: "messages") {
id: UUID! @default(expr: "uuidV4()")
conversationId: UUID!
senderId: String! #userId
#senderName: String
user: User! @ref(fields: "senderId", references: "id")
content: String!
isSystem: Boolean
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String
}

View File

@@ -0,0 +1,66 @@
enum OrderType {
ONE_TIME
PERMANENT
RECURRING
RAPID
}
enum OrderStatus {
DRAFT
POSTED
FILLED
COMPLETED
CANCELLED
PENDING
FULLY_STAFFED
PARTIAL_STAFFED
}
enum OrderDuration {
WEEKLY
MONTHLY
}
#events
type Order @table(name: "orders", key: ["id"]) {
id: UUID! @default(expr: "uuidV4()")
eventName: String
vendorId: UUID
vendor: Vendor @ref(fields: "vendorId", references: "id")
businessId: UUID!
business: Business! @ref(fields: "businessId", references: "id")
orderType: OrderType!
#location: String
status: OrderStatus! @default(expr: "'DRAFT'")
duration: OrderDuration
lunchBreak: Int
total: Float
deparment: String
assignedStaff: Any @col(dataType: "jsonb")
shifts: Any @col(dataType: "jsonb")
requested: Int
teamHubId: UUID!
teamHub: TeamHub! @ref(fields: "teamHubId", references: "id")
date: Timestamp
startDate: Timestamp #for recurring and permanent
endDate: Timestamp #for recurring and permanent
recurringDays: [String!]
poReference: String
permanentDays: [String!]
detectedConflicts: Any @col(dataType:"jsonb")
notes: String
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String
}

View File

@@ -0,0 +1,39 @@
enum RecentPaymentStatus {
PAID
PENDING
FAILED
}
type RecentPayment @table(name: "recent_payments") {
id: UUID! @default(expr: "uuidV4()")
workedTime: String
status: RecentPaymentStatus
staffId: UUID!
applicationId: UUID!
application: Application! @ref(fields: "applicationId", references: "id")
#title: String poner en queries ,dentro de application esta shiftrole que tiene shift adentro, que tiene title
#date: Timestamp poner en queries ,dentro de application esta shiftrole que tiene shift adentro, que tiene date
#address: String poner en queries ,dentro de application esta shiftrole que tiene shift adentro, que tiene locationAddress
#hours: Float poner en queries ,dentro de application esta shiftrole, dentro de shiftrole esta hours
#rate: Float poner en queries ,dentro de application esta shiftrole, dentro de shiftrole esta role que tiene costPerHours
#rolename: Float poner en queries ,dentro de application esta shiftrole, dentro de shiftrole esta role que tiene name
#amount: Float poner en queries ,dentro de application esta shiftrole que tiene totalValue
#startTime poner en queries ,dentro de application esta shiftrole que tiene startTime
#endTime poner en queries ,dentro de application esta shiftrole que tiene endTime
invoiceId: UUID!
invoice: Invoice! @ref(fields: "invoiceId", references: "id")
#poner en queries q salga una busuqeda por businessId que tiene business que esta en invoice, tmbn por vendor
#location: String oner en queries, esto esta dentro de order que tiene invoce, location
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String
}

View File

@@ -0,0 +1,13 @@
type Role @table(name: "roles") {
id: UUID! @default(expr: "uuidV4()")
name: String!
vendorId: UUID!
roleCategoryId: UUID!
costPerHour: Float!
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String
}

View File

@@ -0,0 +1,20 @@
enum RoleCategoryType {
KITCHEN_AND_CULINARY
CONCESSIONS
FACILITIES
BARTENDING
SECURITY
EVENT_STAFF
MANAGEMENT
TECHNICAL
OTHER
}
type RoleCategory @table(name: "role_categories") {
id: UUID! @default(expr: "uuidV4()")
roleName: String!
category: RoleCategoryType!
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String
}

View File

@@ -0,0 +1,51 @@
enum ShiftStatus {
DRAFT
FILLED
ASSIGNED
OPEN
IN_PROGRESS
COMPLETED
CANCELED
}
type Shift @table(name: "shifts", key: ["id"]) {
id: UUID! @default(expr: "uuidV4()")
title: String!
orderId: UUID!
order: Order! @ref(fields: "orderId", references: "id")
date: Timestamp
startTime: Timestamp
endTime: Timestamp
hours: Float
cost: Float
location: String
locationAddress: String
latitude: Float
longitude: Float
placeId: String
city: String
state: String
street: String
country: String
description: String
status: ShiftStatus
workersNeeded: Int
filled: Int
filledAt: Timestamp
# JSON list of managers (e.g. [{name, phone, avatar}, ...])
managers: [Any!]
durationDays: Int
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String
}

View File

@@ -0,0 +1,104 @@
enum BackgroundCheckStatus {
PENDING
CLEARED
FAILED
EXPIRED
NOT_REQUIRED
}
enum EmploymentType {
FULL_TIME
PART_TIME
ON_CALL
WEEKENDS
SPECIFIC_DAYS
SEASONAL
MEDICAL_LEAVE
}
enum DepartmentType {
OPERATIONS
SALES
HR
FINANCE
IT
MARKETING
CUSTOMER_SERVICE
LOGISTICS
}
enum EnglishProficiency {
FLUENT
INTERMEDIATE
BASIC
NONE
}
type Staff @table(name: "staffs") {
id: UUID! @default(expr: "uuidV4()")
userId: String!
# Identity
fullName: String!
level: String
role: String
phone: String
email: String
photoUrl: String
# Metrics
totalShifts: Int
averageRating: Float
onTimeRate: Int
noShowCount: Int
cancellationCount: Int
reliabilityScore: Int
# Gamification
xp: Int @default(expr: "0")
badges: Any
# Profile
bio: String
skills: [String] #changed it for staffRole
industries: [String]
preferredLocations: [String]
maxDistanceMiles: Int
languages: Any
itemsAttire: Any
# Recommendation
isRecommended: Boolean @default(expr: "false")
# Relations / ownership
ownerId: UUID #vendor/business
# web
department: DepartmentType
hubId: UUID
manager: UUID
english: EnglishProficiency
backgroundCheckStatus: BackgroundCheckStatus
employmentType: EmploymentType
initial: String
englishRequired: Boolean @default(expr: "false")
isProfileVisible: Boolean @default(expr: "true")
addres: String
placeId: String
latitude: Float
longitude: Float
city: String
state: String
street: String
country: String
zipCode: String
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String
}

View File

@@ -0,0 +1,27 @@
enum AttireVerificationStatus {
PENDING
PROCESSING
AUTO_PASS
AUTO_FAIL
NEEDS_REVIEW
APPROVED
REJECTED
ERROR
}
type StaffAttire @table(name: "staff_attires", key: ["staffId", "attireOptionId"]) {
staffId: UUID!
staff: Staff! @ref(fields: "staffId", references: "id")
attireOptionId: UUID!
attireOption: AttireOption! @ref(fields: "attireOptionId", references: "id")
# Verification Metadata
verificationStatus: AttireVerificationStatus @default(expr: "'PENDING'")
verifiedAt: Timestamp
verificationPhotoUrl: String # Proof of ownership
verificationId: String
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
}

View File

@@ -0,0 +1,42 @@
enum DayOfWeek {
SUNDAY
MONDAY
TUESDAY
WEDNESDAY
THURSDAY
FRIDAY
SATURDAY
}
enum AvailabilitySlot {
MORNING
AFTERNOON
EVENING
}
enum AvailabilityStatus {
CONFIRMED_AVAILABLE
UNKNOWN
BLOCKED
}
#3 in day, its good?
type StaffAvailability @table(name: "staff_availabilities", key: ["staffId", "day", "slot"]) {
id: UUID! @default(expr: "uuidV4()")
staffId: UUID!
staff: Staff! @ref(fields: "staffId", references: "id")
day: DayOfWeek!
slot: AvailabilitySlot!
status: AvailabilityStatus! @default(expr: "'CONFIRMED_AVAILABLE'")
notes: String
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String @default(expr: "auth.uid")
}

View File

@@ -0,0 +1,18 @@
type StaffAvailabilityStats @table(name: "staff_availability_stats", key: ["staffId"]) {
id: UUID! @default(expr: "uuidV4()")
staffId: UUID!
staff: Staff! @ref(fields: "staffId", references: "id")
needWorkIndex: Int
utilizationPercentage: Int
predictedAvailabilityScore: Int
scheduledHoursThisPeriod: Int
desiredHoursThisPeriod: Int
lastShiftDate: Timestamp
acceptanceRate: Int
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String @default(expr: "auth.uid")
}

View File

@@ -0,0 +1,15 @@
type StaffCourse @table(name: "staff_courses") {
id: UUID! @default(expr: "uuidV4()")
staffId: UUID!
courseId: UUID!
progressPercent: Int @default(expr: "0")
completed: Boolean @default(expr: "false")
completedAt: Timestamp
startedAt: Timestamp
lastAccessedAt: Timestamp
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
}

View File

@@ -0,0 +1,35 @@
enum DocumentStatus {
PENDING
PROCESSING
AUTO_PASS
AUTO_FAIL
NEEDS_REVIEW
APPROVED
REJECTED
ERROR
UPLOADED
EXPIRING
MISSING
VERIFIED
}
type StaffDocument @table(name: "staff_documents", key: ["staffId", "documentId"]) {
id: UUID! @default(expr: "uuidV4()")
staffId: UUID!
staffName: String!
documentId: UUID!
document: Document! @ref(fields: "documentId", references: "id")
status: DocumentStatus! @default(expr: "'PENDING'")
documentUrl: String
expiryDate: Timestamp
# Verification Metadata (Align with Attire flow)
verificationId: String
verifiedAt: Timestamp
rejectionReason: String
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String
}

View File

@@ -0,0 +1,24 @@
enum RoleType {
SKILLED
BEGINNER
CROSS_TRAINED
}
#this is skills of staff
type StaffRole @table(name: "staff_roles", key: ["staffId", "roleId"]) {
id: UUID! @default(expr: "uuidV4()")
staffId: UUID!
staff: Staff! @ref(fields: "staffId", references: "id")
roleId: UUID!
role: Role! @ref(fields: "roleId", references: "id")
roleType: RoleType
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String
}

View File

@@ -0,0 +1,32 @@
enum TaskStatus {
PENDING
IN_PROGRESS
COMPLETED
}
enum TaskPriority {
LOW
NORMAL
HIGH
}
type Task @table(name: "tasks") {
id: UUID! @default(expr: "uuidV4()")
taskName: String! #task identifier
description: String
priority: TaskPriority!
status: TaskStatus!
dueDate: Timestamp
progress: Int
orderIndex: Int
commentCount: Int
attachmentCount: Int
files: Any
ownerId:UUID! #client/vendor
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String
}

View File

@@ -0,0 +1,15 @@
type TaskComment @table(name: "task_comments") {
id: UUID! @default(expr: "uuidV4()")
taskId: UUID!
teamMemberId: UUID!
teamMember: TeamMember! @ref(fields: "teamMemberId", references: "id")
comment: String!
isSystem: Boolean! @default(expr: "false")
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String
}

View File

@@ -0,0 +1,84 @@
enum TaxFormStatus {
NOT_STARTED
DRAFT
SUBMITTED
APPROVED
REJECTED
}
enum TaxFormType {
I9
W4
}
enum MaritalStatus{
SINGLE
MARRIED
HEAD
}
enum CitizenshipStatus{
CITIZEN
NONCITIZEN
PERMANENT_RESIDENT
ALIEN
}
type TaxForm @table(name: "tax_forms") {
id: UUID! @default(expr: "uuidV4()")
formType: TaxFormType!
firstName: String!
lastName: String!
mInitial: String
oLastName:String
dob: Timestamp
socialSN: Int!
email: String
phone: String
address: String!
placeId: String
latitude: Float
longitude: Float
city: String
state: String
street: String
country: String
zipCode: String
apt: String
# form W-4
marital: MaritalStatus
multipleJob: Boolean @default(expr: "false")
childrens: Int
otherDeps: Int
totalCredits: Float @default(expr: "0")
otherInconme: Float @default(expr: "0")
deductions: Float @default(expr: "0")
extraWithholding: Float @default(expr: "0")
# form I-9
citizen: CitizenshipStatus
uscis: String
passportNumber: String
countryIssue: String
prepartorOrTranslator: Boolean @default(expr: "false")
# both forms
signature:String
date: Timestamp
status: TaxFormStatus!
staffId: UUID!
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String
}

View File

@@ -0,0 +1,25 @@
type Team @table(name: "teams") {
id: UUID! @default(expr: "uuidV4()")
teamName: String!
ownerId: UUID! #vendor/business
ownerName: String!
ownerRole: String!
email: String
companyLogo: String
totalMembers: Int
activeMembers: Int
totalHubs: Int
departments: Any
favoriteStaffCount: Int
blockedStaffCount: Int
favoriteStaff: Any
blockedStaff: Any
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String
}

View File

@@ -0,0 +1,30 @@
type TeamHub @table(name: "team_hubs") {
id: UUID! @default(expr: "uuidV4()")
teamId: UUID!
team: Team! @ref(fields: "teamId", references: "id")
costCenterId: UUID
costCenter: CostCenter @ref(fields: "costCenterId", references: "id")
hubName: String!
address: String!
placeId: String
latitude: Float
longitude: Float
city: String
state: String
street: String
country: String
zipCode: String
managerName: String
isActive: Boolean! @default(expr: "true")
departments: Any
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String
}

View File

@@ -0,0 +1,13 @@
type TeamHudDepartment @table(name: "team_hud_departments") {
id: UUID! @default(expr: "uuidV4()")
name: String!
costCenter: String
teamHubId: UUID!
teamHub: TeamHub! @ref(fields: "teamHubId", references: "id")
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String
}

View File

@@ -0,0 +1,40 @@
enum TeamMemberRole {
OWNER
ADMIN
MEMBER
MANAGER
VIEWER
}
enum TeamMemberInviteStatus {
PENDING
ACCEPTED
#EXPIRED
CANCELLED
}
type TeamMember @table(name: "team_members") {
id: UUID! @default(expr: "uuidV4()")
teamId: UUID!
team: Team! @ref(fields: "teamId", references: "id")
userId: String!
user: User! @ref(fields: "userId", references: "id")
role: TeamMemberRole!
title: String
department: String
teamHubId: UUID
teamHub: TeamHub @ref(fields: "teamHubId", references: "id")
isActive: Boolean @default(expr: "true")
inviteStatus: TeamMemberInviteStatus @default(expr: "'PENDING'")
inviteCode: UUID! @default(expr: "uuidV4()")
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String
}

View File

@@ -0,0 +1,17 @@
enum UserBaseRole {
ADMIN
USER
}
type User @table(name: "users") {
id: String! # user_id / uid de Firebase
email: String
phone: String
fullName: String
role: UserBaseRole!
userRole: String
photoUrl: String
createdDate: Timestamp @default(expr: "request.time")
updatedDate: Timestamp @default(expr: "request.time")
createdBy: String
}

View File

@@ -0,0 +1,17 @@
type UserConversation @table(name: "user_conversations", key: ["conversationId", "userId"]) {
id: UUID! @default(expr: "uuidV4()")
conversationId: UUID!
conversation: Conversation! @ref(fields: "conversationId", references: "id")
userId: String!
user: User! @ref(fields: "userId", references: "id")
# per-user state
unreadCount: Int @default(expr: "0")
lastReadAt: Timestamp
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String
}

View File

@@ -0,0 +1,49 @@
enum ApprovalStatus {
APPROVED
}
enum VendorTier {
PREFERRED
APPROVED
STANDARD
}
type Vendor @table(name: "vendors") {
id: UUID! @default(expr: "uuidV4()")
userId: String!
companyName: String!
email: String
phone: String
photoUrl: String
address: String
placeId: String
latitude: Float
longitude: Float
city: String
state: String
street: String
country: String
zipCode: String
billingAddress: String
timezone: String @default(expr: "'UTC'")
legalName: String
doingBusinessAs: String
region: String
#state: String
#city: String
serviceSpecialty: String
approvalStatus: ApprovalStatus
isActive: Boolean
markup: Float
fee: Float
csat: Float
tier: VendorTier
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String
}

View File

@@ -0,0 +1,31 @@
enum CategoryType {
KITCHEN_AND_CULINARY
CONCESSIONS
FACILITIES
BARTENDING
SECURITY
EVENT_STAFF
MANAGEMENT
TECHNICAL
OTHER
}
type VendorRate @table(name: "vendor_rates") {
id: UUID! @default(expr: "uuidV4()")
vendorId: UUID!
vendor: Vendor! @ref(fields: "vendorId", references: "id")
roleName: String
category: CategoryType
clientRate: Float
employeeWage: Float
markupPercentage: Float
vendorFeePercentage: Float
isActive: Boolean
notes: String
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String
}

View File

@@ -0,0 +1,30 @@
# enums cant start by a number, reason of W1099
enum WorkforceEmploymentType {
W2
W1099
TEMPORARY
CONTRACT
}
enum WorkforceStatus {
ACTIVE
INACTIVE
}
type Workforce @table( name: "workforce") {
id: UUID! @default(expr: "uuidV4()")
vendorId: UUID!
vendor: Vendor! @ref(fields: "vendorId", references: "id")
staffId: UUID!
staff: Staff! @ref(fields: "staffId", references: "id")
workforceNumber: String!
employmentType: WorkforceEmploymentType
status: WorkforceStatus @default(expr: "'ACTIVE'")
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String @default(expr: "auth.uid")
}