feat: Integrate Data Connect and Implement Staff List View Directory
This commit is contained in:
41
backend/dataconnect/example/recentPayment/mutations.gql
Normal file
41
backend/dataconnect/example/recentPayment/mutations.gql
Normal file
@@ -0,0 +1,41 @@
|
||||
mutation createRecentPayment(
|
||||
$workedTime: String
|
||||
$status: RecentPaymentStatus
|
||||
$staffId: UUID!
|
||||
$applicationId: UUID!
|
||||
$invoiceId: UUID!
|
||||
) @auth(level: USER) {
|
||||
recentPayment_insert(
|
||||
data: {
|
||||
workedTime: $workedTime
|
||||
status: $status
|
||||
staffId: $staffId
|
||||
applicationId: $applicationId
|
||||
invoiceId: $invoiceId
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
mutation updateRecentPayment(
|
||||
$id: UUID!
|
||||
$workedTime: String
|
||||
$status: RecentPaymentStatus
|
||||
$staffId: UUID
|
||||
$applicationId: UUID
|
||||
$invoiceId: UUID
|
||||
) @auth(level: USER) {
|
||||
recentPayment_update(
|
||||
id: $id
|
||||
data: {
|
||||
workedTime: $workedTime
|
||||
status: $status
|
||||
staffId: $staffId
|
||||
applicationId: $applicationId
|
||||
invoiceId: $invoiceId
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
mutation deleteRecentPayment($id: UUID!) @auth(level: USER) {
|
||||
recentPayment_delete(id: $id)
|
||||
}
|
||||
483
backend/dataconnect/example/recentPayment/queries.gql
Normal file
483
backend/dataconnect/example/recentPayment/queries.gql
Normal file
@@ -0,0 +1,483 @@
|
||||
# ------------------------------------------------------------
|
||||
# LIST ALL (admin/debug)
|
||||
# ------------------------------------------------------------
|
||||
query listRecentPayments(
|
||||
$offset: Int
|
||||
$limit: Int
|
||||
) @auth(level: USER) {
|
||||
recentPayments(offset: $offset, limit: $limit) {
|
||||
id
|
||||
workedTime
|
||||
status
|
||||
staffId
|
||||
applicationId
|
||||
invoiceId
|
||||
createdAt
|
||||
updatedAt
|
||||
createdBy
|
||||
|
||||
application {
|
||||
checkInTime
|
||||
checkOutTime
|
||||
|
||||
shiftRole {
|
||||
hours
|
||||
totalValue
|
||||
startTime
|
||||
endTime
|
||||
|
||||
role {
|
||||
name
|
||||
costPerHour
|
||||
}
|
||||
|
||||
shift {
|
||||
title
|
||||
date
|
||||
location
|
||||
locationAddress
|
||||
description
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
invoice {
|
||||
status
|
||||
invoiceNumber
|
||||
issueDate
|
||||
|
||||
business { id businessName }
|
||||
vendor { id companyName }
|
||||
order { id eventName }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# GET BY ID
|
||||
# ------------------------------------------------------------
|
||||
query getRecentPaymentById($id: UUID!) @auth(level: USER) {
|
||||
recentPayment(id: $id) {
|
||||
id
|
||||
workedTime
|
||||
status
|
||||
staffId
|
||||
applicationId
|
||||
invoiceId
|
||||
createdAt
|
||||
updatedAt
|
||||
createdBy
|
||||
|
||||
application {
|
||||
checkInTime
|
||||
checkOutTime
|
||||
|
||||
shiftRole {
|
||||
hours
|
||||
totalValue
|
||||
startTime
|
||||
endTime
|
||||
|
||||
role {
|
||||
name
|
||||
costPerHour
|
||||
}
|
||||
|
||||
shift {
|
||||
title
|
||||
date
|
||||
location
|
||||
locationAddress
|
||||
description
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
invoice {
|
||||
status
|
||||
invoiceNumber
|
||||
issueDate
|
||||
|
||||
business { id businessName }
|
||||
vendor { id companyName }
|
||||
order { id eventName }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# LIST BY STAFF (Staff view)
|
||||
# ------------------------------------------------------------
|
||||
query listRecentPaymentsByStaffId(
|
||||
$staffId: UUID!
|
||||
$offset: Int
|
||||
$limit: Int
|
||||
) @auth(level: USER) {
|
||||
recentPayments(
|
||||
where: { staffId: { eq: $staffId } }
|
||||
offset: $offset
|
||||
limit: $limit
|
||||
orderBy: { createdAt: DESC }
|
||||
) {
|
||||
id
|
||||
workedTime
|
||||
status
|
||||
staffId
|
||||
applicationId
|
||||
invoiceId
|
||||
createdAt
|
||||
updatedAt
|
||||
createdBy
|
||||
|
||||
application {
|
||||
id
|
||||
status
|
||||
shiftRole {
|
||||
startTime
|
||||
endTime
|
||||
hours
|
||||
totalValue
|
||||
|
||||
role { id name costPerHour }
|
||||
|
||||
shift {
|
||||
id
|
||||
title
|
||||
date
|
||||
locationAddress
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
invoice {
|
||||
id
|
||||
invoiceNumber
|
||||
status
|
||||
issueDate
|
||||
dueDate
|
||||
amount
|
||||
|
||||
business { id businessName }
|
||||
vendor { id companyName }
|
||||
order {
|
||||
id
|
||||
eventName
|
||||
#location
|
||||
|
||||
teamHub {
|
||||
address
|
||||
placeId
|
||||
hubName
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# LIST BY APPLICATION (debug / trace)
|
||||
# ------------------------------------------------------------
|
||||
query listRecentPaymentsByApplicationId(
|
||||
$applicationId: UUID!
|
||||
$offset: Int
|
||||
$limit: Int
|
||||
) @auth(level: USER) {
|
||||
recentPayments(
|
||||
where: { applicationId: { eq: $applicationId } }
|
||||
offset: $offset
|
||||
limit: $limit
|
||||
) {
|
||||
id
|
||||
workedTime
|
||||
status
|
||||
staffId
|
||||
applicationId
|
||||
invoiceId
|
||||
createdAt
|
||||
updatedAt
|
||||
createdBy
|
||||
|
||||
application {
|
||||
id
|
||||
status
|
||||
shiftRole {
|
||||
hours
|
||||
totalValue
|
||||
role { id name costPerHour }
|
||||
shift { id title date locationAddress }
|
||||
}
|
||||
}
|
||||
|
||||
invoice {
|
||||
id
|
||||
invoiceNumber
|
||||
status
|
||||
amount
|
||||
business { id businessName }
|
||||
vendor { id companyName }
|
||||
order {
|
||||
id
|
||||
eventName
|
||||
#location
|
||||
|
||||
teamHub {
|
||||
address
|
||||
placeId
|
||||
hubName
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# LIST BY INVOICE (Vendor/Business can see all payments for invoice)
|
||||
# ------------------------------------------------------------
|
||||
query listRecentPaymentsByInvoiceId(
|
||||
$invoiceId: UUID!
|
||||
$offset: Int
|
||||
$limit: Int
|
||||
) @auth(level: USER) {
|
||||
recentPayments(
|
||||
where: { invoiceId: { eq: $invoiceId } }
|
||||
offset: $offset
|
||||
limit: $limit
|
||||
) {
|
||||
id
|
||||
workedTime
|
||||
status
|
||||
staffId
|
||||
applicationId
|
||||
invoiceId
|
||||
createdAt
|
||||
updatedAt
|
||||
createdBy
|
||||
|
||||
application {
|
||||
id
|
||||
staffId
|
||||
shiftRole {
|
||||
hours
|
||||
totalValue
|
||||
role { id name costPerHour }
|
||||
shift { id title date locationAddress }
|
||||
}
|
||||
}
|
||||
|
||||
invoice {
|
||||
id
|
||||
invoiceNumber
|
||||
status
|
||||
amount
|
||||
business { id businessName }
|
||||
vendor { id companyName }
|
||||
order {
|
||||
id
|
||||
eventName
|
||||
#location
|
||||
|
||||
teamHub {
|
||||
address
|
||||
placeId
|
||||
hubName
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# FILTER BY STATUS (common)
|
||||
# ------------------------------------------------------------
|
||||
query listRecentPaymentsByStatus(
|
||||
$status: RecentPaymentStatus!
|
||||
$offset: Int
|
||||
$limit: Int
|
||||
) @auth(level: USER) {
|
||||
recentPayments(
|
||||
where: { status: { eq: $status } }
|
||||
offset: $offset
|
||||
limit: $limit
|
||||
orderBy: { createdAt: DESC }
|
||||
) {
|
||||
id
|
||||
workedTime
|
||||
status
|
||||
staffId
|
||||
applicationId
|
||||
invoiceId
|
||||
createdAt
|
||||
updatedAt
|
||||
createdBy
|
||||
|
||||
application {
|
||||
id
|
||||
shiftRole {
|
||||
hours
|
||||
totalValue
|
||||
role { id name costPerHour }
|
||||
shift { id title date locationAddress }
|
||||
}
|
||||
}
|
||||
|
||||
invoice {
|
||||
id
|
||||
invoiceNumber
|
||||
status
|
||||
amount
|
||||
business { id businessName }
|
||||
vendor { id companyName }
|
||||
order {
|
||||
id
|
||||
eventName
|
||||
#location
|
||||
|
||||
teamHub {
|
||||
address
|
||||
placeId
|
||||
hubName
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# BY BUSINESS (2-step)
|
||||
# Step 2: pass invoiceIds (from query: listInvoicesByBusinessId)
|
||||
# ------------------------------------------------------------
|
||||
query listRecentPaymentsByInvoiceIds(
|
||||
$invoiceIds: [UUID!]!
|
||||
$offset: Int
|
||||
$limit: Int
|
||||
) @auth(level: USER) {
|
||||
recentPayments(
|
||||
where: { invoiceId: { in: $invoiceIds } }
|
||||
offset: $offset
|
||||
limit: $limit
|
||||
orderBy: { createdAt: DESC }
|
||||
) {
|
||||
id
|
||||
workedTime
|
||||
status
|
||||
staffId
|
||||
applicationId
|
||||
invoiceId
|
||||
createdAt
|
||||
updatedAt
|
||||
createdBy
|
||||
|
||||
application {
|
||||
id
|
||||
shiftRole {
|
||||
hours
|
||||
totalValue
|
||||
role { id name costPerHour }
|
||||
shift { id title date locationAddress }
|
||||
}
|
||||
}
|
||||
|
||||
invoice {
|
||||
id
|
||||
invoiceNumber
|
||||
status
|
||||
amount
|
||||
business { id businessName }
|
||||
vendor { id companyName }
|
||||
order {
|
||||
id
|
||||
eventName
|
||||
#location
|
||||
|
||||
teamHub {
|
||||
address
|
||||
placeId
|
||||
hubName
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# LIST BY BUSINESS ID (direct)
|
||||
# ------------------------------------------------------------
|
||||
query listRecentPaymentsByBusinessId(
|
||||
$businessId: UUID!
|
||||
$offset: Int
|
||||
$limit: Int
|
||||
) @auth(level: USER) {
|
||||
recentPayments(
|
||||
where: {
|
||||
invoice: {
|
||||
businessId: { eq: $businessId }
|
||||
}
|
||||
}
|
||||
offset: $offset
|
||||
limit: $limit
|
||||
orderBy: { createdAt: DESC }
|
||||
) {
|
||||
id
|
||||
workedTime
|
||||
status
|
||||
staffId
|
||||
applicationId
|
||||
invoiceId
|
||||
createdAt
|
||||
updatedAt
|
||||
createdBy
|
||||
|
||||
application {
|
||||
id
|
||||
staffId
|
||||
checkInTime
|
||||
checkOutTime
|
||||
shiftRole {
|
||||
startTime
|
||||
endTime
|
||||
hours
|
||||
totalValue
|
||||
|
||||
role { id name costPerHour }
|
||||
|
||||
shift {
|
||||
id
|
||||
title
|
||||
date
|
||||
location
|
||||
locationAddress
|
||||
description
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
invoice {
|
||||
id
|
||||
invoiceNumber
|
||||
status
|
||||
issueDate
|
||||
dueDate
|
||||
amount
|
||||
|
||||
business { id businessName }
|
||||
vendor { id companyName }
|
||||
order {
|
||||
id
|
||||
eventName
|
||||
#location
|
||||
|
||||
teamHub {
|
||||
address
|
||||
placeId
|
||||
hubName
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user