new query for my shifts

This commit is contained in:
José Salazar
2026-02-19 15:40:34 -05:00
parent 97e3410f7f
commit e6b3eca16d
4 changed files with 96 additions and 6 deletions

View File

@@ -105,7 +105,7 @@ class ClientCreateOrderRepositoryImpl implements ClientCreateOrderRepositoryInte
.state(hub.state) .state(hub.state)
.street(hub.street) .street(hub.street)
.country(hub.country) .country(hub.country)
.status(dc.ShiftStatus.CONFIRMED) .status(dc.ShiftStatus.OPEN)
.workersNeeded(workersNeeded) .workersNeeded(workersNeeded)
.filled(0) .filled(0)
.durationDays(1) .durationDays(1)
@@ -224,7 +224,7 @@ class ClientCreateOrderRepositoryImpl implements ClientCreateOrderRepositoryInte
.state(hub.state) .state(hub.state)
.street(hub.street) .street(hub.street)
.country(hub.country) .country(hub.country)
.status(dc.ShiftStatus.CONFIRMED) .status(dc.ShiftStatus.OPEN)
.workersNeeded(workersNeeded) .workersNeeded(workersNeeded)
.filled(0) .filled(0)
.durationDays(1) .durationDays(1)
@@ -342,7 +342,7 @@ class ClientCreateOrderRepositoryImpl implements ClientCreateOrderRepositoryInte
.state(hub.state) .state(hub.state)
.street(hub.street) .street(hub.street)
.country(hub.country) .country(hub.country)
.status(dc.ShiftStatus.CONFIRMED) .status(dc.ShiftStatus.OPEN)
.workersNeeded(workersNeeded) .workersNeeded(workersNeeded)
.filled(0) .filled(0)
.durationDays(1) .durationDays(1)

View File

@@ -265,7 +265,7 @@ class _ShiftOrderFormSheetState extends State<ShiftOrderFormSheet> {
.state(selectedHub.state) .state(selectedHub.state)
.street(selectedHub.street) .street(selectedHub.street)
.country(selectedHub.country) .country(selectedHub.country)
.status(dc.ShiftStatus.PENDING) .status(dc.ShiftStatus.OPEN)
.workersNeeded(workersNeeded) .workersNeeded(workersNeeded)
.filled(0) .filled(0)
.durationDays(1) .durationDays(1)

View File

@@ -95,11 +95,12 @@ class ShiftsRepositoryImpl
DateTime? end, DateTime? end,
}) async { }) async {
final staffId = await _service.getStaffId(); final staffId = await _service.getStaffId();
var query = _service.connector.getApplicationsByStaffId(staffId: staffId); var query = _service.connector.getMyApplicationsByStaffId(staffId: staffId);
if (start != null && end != null) { if (start != null && end != null) {
query = query.dayStart(_service.toTimestamp(start)).dayEnd(_service.toTimestamp(end)); query = query.dayStart(_service.toTimestamp(start)).dayEnd(_service.toTimestamp(end));
} }
final fdc.QueryResult<dc.GetApplicationsByStaffIdData, dc.GetApplicationsByStaffIdVariables> response = await _service.executeProtected(() => query.execute()); final fdc.QueryResult<dc.GetMyApplicationsByStaffIdData, dc.GetMyApplicationsByStaffIdVariables> response =
await _service.executeProtected(() => query.execute());
final apps = response.data.applications; final apps = response.data.applications;
final List<Shift> shifts = []; final List<Shift> shifts = [];

View File

@@ -356,6 +356,95 @@ query getApplicationsByStaffId(
} }
} }
query getMyApplicationsByStaffId(
$staffId: UUID!
$offset: Int
$limit: Int
$dayStart: Timestamp
$dayEnd: Timestamp
) @auth(level: USER) {
applications(
where: {
staffId: { eq: $staffId }
status: { in: [ CONFIRMED, CHECKED_IN, CHECKED_OUT, LATE, PENDING] }
shift: {
date: { ge: $dayStart, le: $dayEnd }
}
}
offset: $offset
limit: $limit
) {
id
shiftId
staffId
status
appliedAt
checkInTime
checkOutTime
origin
createdAt
shift {
id
title
date
startTime
endTime
location
status
durationDays
description
latitude
longitude
order {
id
eventName
#location
teamHub {
address
placeId
hubName
}
business {
id
businessName
email
contactName
companyLogoUrl
}
vendor {
id
companyName
}
}
}
shiftRole {
id
roleId
count
assigned
startTime
endTime
hours
breakType
isBreakPaid
totalValue
role {
id
name
costPerHour
}
}
}
}
query vaidateDayStaffApplication( query vaidateDayStaffApplication(
$staffId: UUID! $staffId: UUID!
$offset: Int $offset: Int