feat: Refactor code structure and optimize performance across multiple modules
This commit is contained in:
207
mobile-apps/staff-app/lib/features/shifts/data/shifts_gql.dart
Normal file
207
mobile-apps/staff-app/lib/features/shifts/data/shifts_gql.dart
Normal file
@@ -0,0 +1,207 @@
|
||||
import 'package:krow/core/application/clients/api/gql.dart';
|
||||
|
||||
const String _shiftFields = '''
|
||||
id
|
||||
status
|
||||
status_updated_at
|
||||
start_at
|
||||
end_at
|
||||
clock_in
|
||||
clock_out
|
||||
break_in
|
||||
break_out
|
||||
...position
|
||||
cancel_reason {
|
||||
type
|
||||
reason
|
||||
details
|
||||
}
|
||||
rating {
|
||||
id
|
||||
rating
|
||||
}
|
||||
''';
|
||||
|
||||
const String getShiftsQuery = '''
|
||||
$_positionFragment
|
||||
|
||||
query GetShifts (\$status: EventShiftPositionStaffStatusInput!, \$first: Int!, \$after: String) {
|
||||
staff_shifts(status: \$status, first: \$first, after: \$after) {
|
||||
pageInfo {
|
||||
hasNextPage
|
||||
}
|
||||
edges {
|
||||
node {
|
||||
$_shiftFields
|
||||
}
|
||||
cursor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
''';
|
||||
|
||||
const String staffNoBreakShifts = '''
|
||||
$_positionFragment
|
||||
|
||||
query staffNoBreakShifts (\$first: Int!) {
|
||||
staff_no_break_shifts(first: \$first) {
|
||||
pageInfo{
|
||||
}
|
||||
edges {
|
||||
|
||||
node {
|
||||
$_shiftFields
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
''';
|
||||
|
||||
const String getShiftPositionQuery = '''
|
||||
$_positionFragment
|
||||
query GetShiftPosition (\$id: ID!) {
|
||||
staff_shift(id: \$id) {
|
||||
$_shiftFields
|
||||
}
|
||||
}
|
||||
''';
|
||||
|
||||
const String acceptShiftMutation = '''
|
||||
$_positionFragment
|
||||
|
||||
mutation AcceptShift(\$id: ID!) {
|
||||
accept_shift(position_id: \$id) {
|
||||
$_shiftFields
|
||||
}
|
||||
}
|
||||
''';
|
||||
|
||||
const String trackStaffClockin = '''
|
||||
mutation TrackStaffClockin(\$id: ID!) {
|
||||
track_staff_clockin(position_staff_id: \$id) {
|
||||
|
||||
}
|
||||
}
|
||||
''';
|
||||
|
||||
const String completeShiftMutation = '''
|
||||
mutation CompleteShift(\$id: ID!, \$break_in: DateTime, \$break_out: DateTime) {
|
||||
track_staff_clockout(position_staff_id: \$id, break_in: \$break_in, break_out: \$break_out) {
|
||||
}
|
||||
}
|
||||
''';
|
||||
|
||||
const String trackStaffBreak = '''
|
||||
mutation trackStaffBreak(\$id: ID!, \$break_in: DateTime!, \$break_out: DateTime!) {
|
||||
track_staff_break(position_staff_id: \$id, break_in: \$break_in, break_out: \$break_out) {
|
||||
}
|
||||
}
|
||||
''';
|
||||
|
||||
const String submitNoBreakStaffShiftMutation = '''
|
||||
mutation SubmitNoBreakStaffShift(\$id: ID!, \$reason: NoBreakShiftPenaltyLogReason, \$details: String) {
|
||||
submit_no_break_staff_shift(position_staff_id: \$id, reason: \$reason, details: \$details) {
|
||||
}
|
||||
}
|
||||
''';
|
||||
|
||||
const String cancelStaffShiftMutation = '''
|
||||
|
||||
mutation cancelStaffShiftMutation(\$position_id: ID!, \$reason: CancelShiftPenaltyLogReason, \$details: String) {
|
||||
cancel_staff_shift(position_staff_id: \$position_id, reason: \$reason, details: \$details) {
|
||||
}
|
||||
}
|
||||
''';
|
||||
|
||||
const String declineStaffShiftMutation = '''
|
||||
mutation DeclineStaffShift(\$position_id: ID!,\$reason: DeclineShiftPenaltyLogReason, \$details: String) {
|
||||
decline_shift(position_id: \$position_id, reason: \$reason, details: \$details) {
|
||||
}
|
||||
}
|
||||
''';
|
||||
|
||||
const _positionFragment = '''
|
||||
$skillFragment
|
||||
|
||||
fragment position on EventShiftPositionStaff {
|
||||
position {
|
||||
id
|
||||
start_time
|
||||
end_time
|
||||
rate
|
||||
break
|
||||
...shift
|
||||
...business_skill
|
||||
}
|
||||
}
|
||||
|
||||
fragment shift on EventShiftPosition {
|
||||
shift {
|
||||
id
|
||||
name
|
||||
address
|
||||
...FullAddress
|
||||
...contacts
|
||||
event {
|
||||
id
|
||||
date
|
||||
name
|
||||
...business
|
||||
additional_info
|
||||
tags{
|
||||
id
|
||||
name
|
||||
slug
|
||||
}
|
||||
addons{
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fragment business_skill on EventShiftPosition {
|
||||
business_skill {
|
||||
skill {
|
||||
...SkillFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fragment business on Event {
|
||||
business {
|
||||
name
|
||||
avatar
|
||||
}
|
||||
}
|
||||
|
||||
fragment contacts on EventShift {
|
||||
contacts {
|
||||
id
|
||||
first_name
|
||||
last_name
|
||||
avatar
|
||||
title
|
||||
auth_info {
|
||||
email
|
||||
phone
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fragment FullAddress on EventShift {
|
||||
full_address {
|
||||
street_number
|
||||
zip_code
|
||||
latitude
|
||||
longitude
|
||||
formatted_address
|
||||
street
|
||||
region
|
||||
city
|
||||
country
|
||||
}
|
||||
}
|
||||
''';
|
||||
Reference in New Issue
Block a user