Merge branch 'dev' into 538-be-assign-a-hub-manager-to-an-order

This commit is contained in:
Achintha Isuru
2026-02-26 10:38:47 -05:00
22 changed files with 454 additions and 616 deletions

View File

@@ -1,4 +1,3 @@
# ----------------------------------------------------------
# LIST ALL (admin/debug)
# ----------------------------------------------------------
@@ -78,7 +77,6 @@ query listBenefitsDataByStaffId(
vendorBenefitPlan {
id
vendorId
title
description
requestLabel
@@ -156,4 +154,4 @@ query listBenefitsDataByVendorBenefitPlanIds(
isActive
}
}
}
}

View File

@@ -5,11 +5,11 @@ mutation CreateCertificate(
$status: CertificateStatus!
$fileUrl: String
$icon: String
$certificationType: ComplianceType
$certificationType: ComplianceType!
$issuer: String
$staffId: UUID!
$validationStatus: ValidationStatus
$certificateNumber: String
$certificateNumber: String
) @auth(level: USER) {
certificate_insert(
data: {
@@ -25,25 +25,24 @@ mutation CreateCertificate(
validationStatus: $validationStatus
certificateNumber: $certificateNumber
}
)
)
}
mutation UpdateCertificate(
$id: UUID!
$staffId: UUID!
$certificationType: ComplianceType!
$name: String
$description: String
$expiry: Timestamp
$status: CertificateStatus
$fileUrl: String
$icon: String
$staffId: UUID
$certificationType: ComplianceType
$issuer: String
$validationStatus: ValidationStatus
$certificateNumber: String
$certificateNumber: String
) @auth(level: USER) {
certificate_update(
id: $id
key: { staffId: $staffId, certificationType: $certificationType }
data: {
name: $name
description: $description
@@ -51,15 +50,56 @@ mutation UpdateCertificate(
status: $status
fileUrl: $fileUrl
icon: $icon
staffId: $staffId
certificationType: $certificationType
issuer: $issuer
validationStatus: $validationStatus
certificateNumber: $certificateNumber
}
)
)
}
mutation DeleteCertificate($id: UUID!) @auth(level: USER) {
certificate_delete(id: $id)
mutation DeleteCertificate($staffId: UUID!, $certificationType: ComplianceType!)
@auth(level: USER) {
certificate_delete(
key: { staffId: $staffId, certificationType: $certificationType }
)
}
# UPSERT STAFF CERTIFICATE
# Creates the certificate record if it does not exist, or updates
# it if it already exists (matched by staffId + certificationType key).
# Use this when uploading a certificate for the first time or
# updating an existing one.
#
# To update multiple certificates in a single network call, use
# aliased mutations in one GraphQL request from the client:
#
# mutation {
# cert1: upsertStaffCertificate(staffId: $id, certificationType: BACKGROUND_CHECK, ...)
# cert2: upsertStaffCertificate(staffId: $id, certificationType: FOOD_HANDLER, ...)
# }
# ------------------------------------------------------------
mutation upsertStaffCertificate(
$staffId: UUID!
$certificationType: ComplianceType!
$name: String!
$status: CertificateStatus!
$fileUrl: String
$expiry: Timestamp
$issuer: String
$certificateNumber: String
$validationStatus: ValidationStatus
) @auth(level: USER) {
certificate_upsert(
data: {
staffId: $staffId
certificationType: $certificationType
name: $name
status: $status
fileUrl: $fileUrl
expiry: $expiry
issuer: $issuer
certificateNumber: $certificateNumber
validationStatus: $validationStatus
}
)
}

View File

@@ -18,12 +18,14 @@ query listCertificates @auth(level: USER) {
id
fullName
}
}
}
query getCertificateById($id: UUID!) @auth(level: USER) {
certificate(id: $id) {
query getCertificateByKey($staffId: UUID!, $certificationType: ComplianceType!)
@auth(level: USER) {
certificate(
key: { staffId: $staffId, certificationType: $certificationType }
) {
id
name
description
@@ -42,7 +44,6 @@ query getCertificateById($id: UUID!) @auth(level: USER) {
id
fullName
}
}
}
@@ -66,7 +67,5 @@ query listCertificatesByStaffId($staffId: UUID!) @auth(level: USER) {
id
fullName
}
}
}

View File

@@ -0,0 +1,37 @@
# ----------------------------------------------------------
# CREATE COST CENTER
# ----------------------------------------------------------
mutation createCostCenter(
$name: String!
$createdBy: String
) @auth(level: USER) {
costCenter_insert(
data: {
name: $name
createdBy: $createdBy
}
)
}
# ----------------------------------------------------------
# UPDATE COST CENTER
# ----------------------------------------------------------
mutation updateCostCenter(
$id: UUID!
$name: String
) @auth(level: USER) {
costCenter_update(
id: $id
data: {
name: $name
}
)
}
# ----------------------------------------------------------
# DELETE COST CENTER
# ----------------------------------------------------------
mutation deleteCostCenter($id: UUID!) @auth(level: USER) {
costCenter_delete(id: $id)
}

View File

@@ -0,0 +1,47 @@
# ----------------------------------------------------------
# LIST ALL COST CENTERS
# ----------------------------------------------------------
query listCostCenters(
$offset: Int
$limit: Int
) @auth(level: USER) {
costCenters(offset: $offset, limit: $limit) {
id
name
createdAt
updatedAt
createdBy
}
}
# ----------------------------------------------------------
# GET BY ID
# ----------------------------------------------------------
query getCostCenterById($id: UUID!) @auth(level: USER) {
costCenter(id: $id) {
id
name
createdAt
updatedAt
createdBy
}
}
# ----------------------------------------------------------
# GET COST CENTER LINKED TO A SPECIFIC HUB
# ----------------------------------------------------------
query getCostCenterByHubId($hubId: UUID!) @auth(level: USER) {
hubs(where: { id: { eq: $hubId } }) {
id
name
costCenterId
costCenter {
id
name
createdAt
updatedAt
createdBy
}
}
}

View File

@@ -39,3 +39,24 @@ mutation updateHub(
mutation deleteHub($id: UUID!) @auth(level: USER) {
hub_delete(id: $id)
}
mutation assignCostCenterToHub(
$hubId: UUID!
$costCenterId: UUID!
) @auth(level: USER) {
hub_update(
id: $hubId
data: {
costCenterId: $costCenterId
}
)
}
mutation removeCostCenterFromHub($hubId: UUID!) @auth(level: USER) {
hub_update(
id: $hubId
data: {
costCenterId: null
}
)
}

View File

@@ -6,6 +6,11 @@ query listHubs @auth(level: USER) {
address
nfcTagId
ownerId
costCenterId
costCenter {
id
name
}
createdAt
updatedAt
createdBy
@@ -20,6 +25,11 @@ query getHubById($id: UUID!) @auth(level: USER) {
address
nfcTagId
ownerId
costCenterId
costCenter {
id
name
}
createdAt
updatedAt
createdBy
@@ -34,6 +44,11 @@ query getHubsByOwnerId($ownerId: UUID!) @auth(level: USER) {
address
nfcTagId
ownerId
costCenterId
costCenter {
id
name
}
createdAt
updatedAt
createdBy
@@ -58,5 +73,10 @@ query filterHubs(
address
nfcTagId
ownerId
costCenterId
costCenter {
id
name
}
}
}

View File

@@ -5,6 +5,7 @@ mutation createInvoice(
$vendorId: UUID!
$businessId: UUID!
$orderId: UUID!
$shiftId: UUID
$paymentTerms: InovicePaymentTerms
$invoiceNumber: String!
@@ -31,6 +32,7 @@ mutation createInvoice(
vendorId: $vendorId
businessId: $businessId
orderId: $orderId
shiftId: $shiftId
paymentTerms: $paymentTerms
invoiceNumber: $invoiceNumber
@@ -61,6 +63,7 @@ mutation updateInvoice(
$vendorId: UUID
$businessId: UUID
$orderId: UUID
$shiftId: UUID
$paymentTerms: InovicePaymentTerms
$invoiceNumber: String
@@ -92,6 +95,7 @@ mutation updateInvoice(
vendorId: $vendorId
businessId: $businessId
orderId: $orderId
shiftId: $shiftId
paymentTerms: $paymentTerms
invoiceNumber: $invoiceNumber
@@ -121,3 +125,39 @@ mutation updateInvoice(
mutation deleteInvoice($id: UUID!) @auth(level: USER) {
invoice_delete(id: $id)
}
# ------------------------------------------------------------
# APPROVE INVOICE
# Called by the client to approve a shift-day completion record.
# Sets status to APPROVED, triggering the invoice-ready state.
# ------------------------------------------------------------
mutation approveInvoice($id: UUID!) @auth(level: USER) {
invoice_update(
id: $id
data: {
status: APPROVED
}
)
}
# ------------------------------------------------------------
# DISPUTE INVOICE
# Called by the client to dispute a shift-day completion record.
# Sets status to DISPUTED and stores the dispute details.
# ------------------------------------------------------------
mutation disputeInvoice(
$id: UUID!
$disputedItems: Any
$disputeReason: String!
$disputeDetails: String
) @auth(level: USER) {
invoice_update(
id: $id
data: {
status: DISPUTED
disputedItems: $disputedItems
disputeReason: $disputeReason
disputeDetails: $disputeDetails
}
)
}

View File

@@ -13,6 +13,7 @@ query listInvoices(
vendorId
businessId
orderId
shiftId
paymentTerms
invoiceNumber
@@ -74,6 +75,7 @@ query getInvoiceById($id: UUID!) @auth(level: USER) {
vendorId
businessId
orderId
shiftId
paymentTerms
invoiceNumber
@@ -144,6 +146,7 @@ query listInvoicesByVendorId(
vendorId
businessId
orderId
shiftId
paymentTerms
invoiceNumber
@@ -214,6 +217,7 @@ query listInvoicesByBusinessId(
vendorId
businessId
orderId
shiftId
paymentTerms
invoiceNumber
@@ -284,6 +288,7 @@ query listInvoicesByOrderId(
vendorId
businessId
orderId
shiftId
paymentTerms
invoiceNumber
@@ -354,6 +359,7 @@ query listInvoicesByStatus(
vendorId
businessId
orderId
shiftId
paymentTerms
invoiceNumber
@@ -407,11 +413,14 @@ query listInvoicesByStatus(
# ------------------------------------------------------------
# FILTER INVOICES (multi filters)
# NOTE: Timestamp filters use ge/le (NOT gte/lte)
# Supports shiftId filter — use with status: PENDING_REVIEW to list
# shift-day completion records awaiting client approval.
# ------------------------------------------------------------
query filterInvoices(
$vendorId: UUID
$businessId: UUID
$orderId: UUID
$shiftId: UUID
$status: InvoiceStatus
$issueDateFrom: Timestamp
@@ -428,6 +437,7 @@ query filterInvoices(
vendorId: { eq: $vendorId }
businessId: { eq: $businessId }
orderId: { eq: $orderId }
shiftId: { eq: $shiftId }
status: { eq: $status }
issueDate: { ge: $issueDateFrom, le: $issueDateTo }
@@ -443,6 +453,7 @@ query filterInvoices(
vendorId
businessId
orderId
shiftId
paymentTerms
invoiceNumber
@@ -517,6 +528,7 @@ query listOverdueInvoices(
vendorId
businessId
orderId
shiftId
paymentTerms
invoiceNumber

View File

@@ -100,3 +100,26 @@ mutation updateOrder(
mutation deleteOrder($id: UUID!) @auth(level: USER) {
order_delete(id: $id)
}
mutation assignHubManagerToOrder(
$orderId: UUID!
$hubManagerId: UUID!
) @auth(level: USER) {
order_update(
id: $orderId
data: {
hubManagerId: $hubManagerId
}
)
}
mutation removeHubManagerFromOrder(
$orderId: UUID!
) @auth(level: USER) {
order_update(
id: $orderId
data: {
hubManagerId: null
}
)
}

View File

@@ -48,6 +48,18 @@ query listOrders(
hubName
}
hubManager {
id
role
title
user {
id
fullName
email
photoUrl
}
}
}
}
@@ -98,6 +110,18 @@ query getOrderById($id: UUID!) @auth(level: USER) {
hubName
}
hubManager {
id
role
title
user {
id
fullName
email
photoUrl
}
}
}
}
@@ -156,6 +180,18 @@ query getOrdersByBusinessId(
hubName
}
hubManager {
id
role
title
user {
id
fullName
email
photoUrl
}
}
}
}
@@ -214,6 +250,18 @@ query getOrdersByVendorId(
hubName
}
hubManager {
id
role
title
user {
id
fullName
email
photoUrl
}
}
}
}
@@ -272,6 +320,18 @@ query getOrdersByStatus(
hubName
}
hubManager {
id
role
title
user {
id
fullName
email
photoUrl
}
}
}
}
@@ -333,6 +393,18 @@ query getOrdersByDateRange(
hubName
}
hubManager {
id
role
title
user {
id
fullName
email
photoUrl
}
}
}
}
@@ -390,6 +462,18 @@ query getRapidOrders(
hubName
}
hubManager {
id
role
title
user {
id
fullName
email
photoUrl
}
}
}
}
@@ -528,3 +612,27 @@ query listCompletedOrdersByBusinessAndDateRange(
}
}
# ------------------------------------------------------------
# GET HUB MANAGER ASSIGNED TO AN ORDER
# ------------------------------------------------------------
query getHubManagerByOrderId($orderId: UUID!) @auth(level: USER) {
order(id: $orderId) {
id
hubManagerId
hubManager {
id
role
title
department
teamHubId
isActive
user {
id
fullName
email
photoUrl
}
}
}
}

View File

@@ -1,129 +0,0 @@
# ------------------------------------------------------------
# CREATE — called automatically at the end of each shift day
# ------------------------------------------------------------
mutation createShiftDayCompletion(
$shiftId: UUID!
$orderId: UUID!
$businessId: UUID!
$vendorId: UUID!
$dayDate: Timestamp!
$dayNumber: Int!
$hours: Float
$cost: Float
$staffSummary: Any
$createdBy: String
) @auth(level: USER) {
shiftDayCompletion_insert(
data: {
shiftId: $shiftId
orderId: $orderId
businessId: $businessId
vendorId: $vendorId
dayDate: $dayDate
dayNumber: $dayNumber
status: PENDING_REVIEW
hours: $hours
cost: $cost
staffSummary: $staffSummary
createdBy: $createdBy
}
)
}
# ------------------------------------------------------------
# APPROVE — client approves a daily completion record
# ------------------------------------------------------------
mutation approveShiftDayCompletion(
$id: UUID!
$reviewedBy: String!
$reviewedAt: Timestamp!
) @auth(level: USER) {
shiftDayCompletion_update(
id: $id
data: {
status: APPROVED
reviewedBy: $reviewedBy
reviewedAt: $reviewedAt
}
)
}
# ------------------------------------------------------------
# DISPUTE — client disputes a daily completion record
# ------------------------------------------------------------
mutation disputeShiftDayCompletion(
$id: UUID!
$reviewedBy: String!
$reviewedAt: Timestamp!
$disputeReason: String!
$disputeDetails: String
$disputedItems: Any
) @auth(level: USER) {
shiftDayCompletion_update(
id: $id
data: {
status: DISPUTED
reviewedBy: $reviewedBy
reviewedAt: $reviewedAt
disputeReason: $disputeReason
disputeDetails: $disputeDetails
disputedItems: $disputedItems
}
)
}
# ------------------------------------------------------------
# LINK INVOICE — set once invoice is generated after full approval
# ------------------------------------------------------------
mutation linkInvoiceToShiftDayCompletion(
$id: UUID!
$invoiceId: UUID!
) @auth(level: USER) {
shiftDayCompletion_update(
id: $id
data: {
invoiceId: $invoiceId
}
)
}
# ------------------------------------------------------------
# UPDATE — general-purpose update (admin use)
# ------------------------------------------------------------
mutation updateShiftDayCompletion(
$id: UUID!
$status: ShiftDayCompletionStatus
$hours: Float
$cost: Float
$staffSummary: Any
$disputeReason: String
$disputeDetails: String
$disputedItems: Any
$reviewedBy: String
$reviewedAt: Timestamp
$invoiceId: UUID
) @auth(level: USER) {
shiftDayCompletion_update(
id: $id
data: {
status: $status
hours: $hours
cost: $cost
staffSummary: $staffSummary
disputeReason: $disputeReason
disputeDetails: $disputeDetails
disputedItems: $disputedItems
reviewedBy: $reviewedBy
reviewedAt: $reviewedAt
invoiceId: $invoiceId
}
)
}
# ------------------------------------------------------------
# DELETE
# ------------------------------------------------------------
mutation deleteShiftDayCompletion($id: UUID!) @auth(level: USER) {
shiftDayCompletion_delete(id: $id)
}

View File

@@ -1,417 +0,0 @@
# ------------------------------------------------------------
# GET BY ID
# ------------------------------------------------------------
query getShiftDayCompletionById($id: UUID!) @auth(level: USER) {
shiftDayCompletion(id: $id) {
id
shiftId
orderId
businessId
vendorId
dayDate
dayNumber
status
hours
cost
staffSummary
disputeReason
disputeDetails
disputedItems
reviewedBy
reviewedAt
invoiceId
createdAt
updatedAt
createdBy
shift {
id
title
date
startTime
endTime
hours
durationDays
status
}
order {
id
eventName
orderType
poReference
teamHub {
hubName
address
}
}
business {
id
businessName
email
contactName
}
vendor {
id
companyName
email
}
invoice {
id
invoiceNumber
status
issueDate
dueDate
amount
}
}
}
# ------------------------------------------------------------
# LIST ALL COMPLETION RECORDS FOR A SHIFT
# ------------------------------------------------------------
query listShiftDayCompletionsByShift(
$shiftId: UUID!
$offset: Int
$limit: Int
) @auth(level: USER) {
shiftDayCompletions(
where: { shiftId: { eq: $shiftId } }
orderBy: { dayNumber: ASC }
offset: $offset
limit: $limit
) {
id
shiftId
orderId
businessId
vendorId
dayDate
dayNumber
status
hours
cost
staffSummary
disputeReason
disputeDetails
disputedItems
reviewedBy
reviewedAt
invoiceId
createdAt
updatedAt
shift {
id
title
date
startTime
endTime
durationDays
status
}
invoice {
id
invoiceNumber
status
amount
}
}
}
# ------------------------------------------------------------
# LIST ALL COMPLETION RECORDS FOR AN ORDER
# ------------------------------------------------------------
query listShiftDayCompletionsByOrder(
$orderId: UUID!
$offset: Int
$limit: Int
) @auth(level: USER) {
shiftDayCompletions(
where: { orderId: { eq: $orderId } }
orderBy: { dayDate: ASC }
offset: $offset
limit: $limit
) {
id
shiftId
orderId
businessId
vendorId
dayDate
dayNumber
status
hours
cost
staffSummary
disputeReason
disputeDetails
disputedItems
reviewedBy
reviewedAt
invoiceId
createdAt
updatedAt
shift {
id
title
date
startTime
endTime
durationDays
status
}
invoice {
id
invoiceNumber
status
amount
}
}
}
# ------------------------------------------------------------
# LIST PENDING REVIEW RECORDS FOR A BUSINESS (client view)
# ------------------------------------------------------------
query listPendingShiftDayCompletionsByBusiness(
$businessId: UUID!
$offset: Int
$limit: Int
) @auth(level: USER) {
shiftDayCompletions(
where: {
businessId: { eq: $businessId }
status: { eq: PENDING_REVIEW }
}
orderBy: { dayDate: ASC }
offset: $offset
limit: $limit
) {
id
shiftId
orderId
businessId
vendorId
dayDate
dayNumber
status
hours
cost
staffSummary
createdAt
updatedAt
shift {
id
title
date
startTime
endTime
durationDays
status
location
locationAddress
}
order {
id
eventName
orderType
poReference
teamHub {
hubName
address
}
}
vendor {
id
companyName
}
}
}
# ------------------------------------------------------------
# LIST ALL RECORDS FOR A BUSINESS FILTERED BY STATUS
# ------------------------------------------------------------
query listShiftDayCompletionsByBusinessAndStatus(
$businessId: UUID!
$status: ShiftDayCompletionStatus!
$offset: Int
$limit: Int
) @auth(level: USER) {
shiftDayCompletions(
where: {
businessId: { eq: $businessId }
status: { eq: $status }
}
orderBy: { dayDate: DESC }
offset: $offset
limit: $limit
) {
id
shiftId
orderId
businessId
vendorId
dayDate
dayNumber
status
hours
cost
staffSummary
disputeReason
disputeDetails
disputedItems
reviewedBy
reviewedAt
invoiceId
createdAt
updatedAt
shift {
id
title
date
startTime
endTime
durationDays
status
}
order {
id
eventName
orderType
poReference
}
invoice {
id
invoiceNumber
status
amount
}
}
}
# ------------------------------------------------------------
# LIST ALL APPROVED RECORDS FOR A SHIFT (invoice trigger check)
# ------------------------------------------------------------
query listApprovedShiftDayCompletionsByShift(
$shiftId: UUID!
) @auth(level: USER) {
shiftDayCompletions(
where: {
shiftId: { eq: $shiftId }
status: { eq: APPROVED }
}
orderBy: { dayNumber: ASC }
) {
id
shiftId
orderId
businessId
vendorId
dayDate
dayNumber
status
hours
cost
staffSummary
reviewedBy
reviewedAt
invoiceId
createdAt
updatedAt
shift {
id
title
durationDays
hours
cost
status
order {
id
eventName
businessId
vendorId
poReference
teamHub {
hubName
address
}
}
}
}
}
# ------------------------------------------------------------
# LIST ALL RECORDS BY VENDOR FILTERED BY STATUS
# ------------------------------------------------------------
query listShiftDayCompletionsByVendorAndStatus(
$vendorId: UUID!
$status: ShiftDayCompletionStatus!
$offset: Int
$limit: Int
) @auth(level: USER) {
shiftDayCompletions(
where: {
vendorId: { eq: $vendorId }
status: { eq: $status }
}
orderBy: { dayDate: DESC }
offset: $offset
limit: $limit
) {
id
shiftId
orderId
businessId
vendorId
dayDate
dayNumber
status
hours
cost
staffSummary
disputeReason
disputeDetails
reviewedBy
reviewedAt
invoiceId
createdAt
updatedAt
shift {
id
title
date
startTime
endTime
durationDays
status
}
business {
id
businessName
email
}
invoice {
id
invoiceNumber
status
amount
}
}
}

View File

@@ -31,10 +31,46 @@ mutation updateStaffDocument(
data: {
status: $status
documentUrl: $documentUrl
expiryDate: $expiryDate
}
)
}
# ------------------------------------------------------------
# UPSERT STAFF DOCUMENT
# Creates the document record if it does not exist, or updates
# it if it already exists (matched by staffId + documentId key).
# Use this when uploading a document for the first time or
# re-uploading/updating an existing one.
#
# To update multiple documents in a single network call, use
# aliased mutations in one GraphQL request from the client:
#
# mutation {
# doc1: upsertStaffDocument(staffId: $id, staffName: $name, documentId: $d1, ...)
# doc2: upsertStaffDocument(staffId: $id, staffName: $name, documentId: $d2, ...)
# }
# ------------------------------------------------------------
mutation upsertStaffDocument(
$staffId: UUID!
$staffName: String!
$documentId: UUID!
$status: DocumentStatus!
$documentUrl: String
$expiryDate: Timestamp
) @auth(level: USER) {
staffDocument_upsert(
data: {
staffId: $staffId
staffName: $staffName
documentId: $documentId
status: $status
documentUrl: $documentUrl
expiryDate: $expiryDate
}
)
}
mutation deleteStaffDocument(
$staffId: UUID!
$documentId: UUID!

View File

@@ -64,3 +64,35 @@ query getTeamMembersByTeamId($teamId: UUID!) @auth(level: USER) {
}
}
}
query getHubManagersByTeamHubId($teamHubId: UUID!) @auth(level: USER) {
teamMembers(
where: {
teamHubId: { eq: $teamHubId }
role: { eq: MANAGER }
isActive: { eq: true }
inviteStatus: { eq: ACCEPTED }
}
) {
id
teamId
role
title
department
teamHubId
isActive
createdAt
user {
id
fullName
email
photoUrl
}
teamHub {
id
hubName
}
}
}

View File

@@ -30,7 +30,7 @@ enum ValidationStatus {
}
type Certificate @table(name: "certificates") {
type Certificate @table(name: "certificates", key: ["staffId", "certificationType"]) {
id: UUID! @default(expr: "uuidV4()")
name: String!
@@ -39,7 +39,7 @@ type Certificate @table(name: "certificates") {
status: CertificateStatus!
fileUrl: String
icon: String
certificationType: ComplianceType
certificationType: ComplianceType!
issuer: String #Issuing Authority
certificateNumber: String

View File

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

View File

@@ -5,6 +5,8 @@ type Hub @table(name: "hubs") {
address: String
nfcTagId: String
ownerId: UUID!
costCenterId: UUID
costCenter: CostCenter @ref(fields: "costCenterId", references: "id")
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String

View File

@@ -31,6 +31,9 @@ type Invoice @table(name: "invoices") {
orderId: UUID!
order: Order! @ref(fields: "orderId", references: "id")
shiftId: UUID
shift: Shift @ref(fields: "shiftId", references: "id")
#web
paymentTerms: InovicePaymentTerms
invoiceNumber: String!

View File

@@ -1,45 +0,0 @@
enum ShiftDayCompletionStatus {
PENDING_REVIEW
APPROVED
DISPUTED
}
type ShiftDayCompletion @table(name: "shift_day_completions", key: ["id"]) {
id: UUID! @default(expr: "uuidV4()")
shiftId: UUID!
shift: Shift! @ref(fields: "shiftId", references: "id")
orderId: UUID!
order: Order! @ref(fields: "orderId", references: "id")
businessId: UUID!
business: Business! @ref(fields: "businessId", references: "id")
vendorId: UUID!
vendor: Vendor! @ref(fields: "vendorId", references: "id")
dayDate: Timestamp!
dayNumber: Int!
status: ShiftDayCompletionStatus! @default(expr: "'PENDING_REVIEW'")
hours: Float
cost: Float
staffSummary: Any @col(dataType: "jsonb")
disputeReason: String
disputeDetails: String
disputedItems: Any @col(dataType: "jsonb")
reviewedBy: String
reviewedAt: Timestamp
invoiceId: UUID
invoice: Invoice @ref(fields: "invoiceId", references: "id")
createdAt: Timestamp @default(expr: "request.time")
updatedAt: Timestamp @default(expr: "request.time")
createdBy: String
}

View File

@@ -1,7 +1,11 @@
# --- Environment & Variables ---
# Flutter check
ifeq ($(OS),Windows_NT)
FLUTTER := flutter
else
FLUTTER := $(shell which flutter)
endif
# Firebase & GCP Configuration
GCP_DEV_PROJECT_ID := krow-workforce-dev

View File

@@ -268,4 +268,4 @@ dataconnect-bootstrap-validation-database: dataconnect-file-validation
@echo "⚠️ Generating Data Connect SDK ($(DC_SERVICE))..."
@firebase dataconnect:sdk:generate --project=$(FIREBASE_ALIAS)
@echo "🎉 Validation Cloud SQL + Data Connect bootstrap completed successfully!"
@echo "🎉 Validation Cloud SQL + Data Connect bootstrap completed successfully!"