feat: Refactor code structure and optimize performance across multiple modules
This commit is contained in:
272
mobile-apps/client-app/lib/features/events/data/events_gql.dart
Normal file
272
mobile-apps/client-app/lib/features/events/data/events_gql.dart
Normal file
@@ -0,0 +1,272 @@
|
||||
String getEventsQuery = '''
|
||||
query GetEvents (\$status: EventStatus!, \$first: Int!, \$after: String) {
|
||||
client_events(status: \$status, first: \$first, after: \$after) {
|
||||
pageInfo {
|
||||
hasNextPage
|
||||
hasPreviousPage
|
||||
startCursor
|
||||
endCursor
|
||||
total
|
||||
count
|
||||
currentPage
|
||||
lastPage
|
||||
}
|
||||
edges {
|
||||
...node
|
||||
cursor
|
||||
}
|
||||
}
|
||||
}
|
||||
$nodeFragment
|
||||
''';
|
||||
|
||||
var getEventById = '''
|
||||
query GetEventById(\$id: ID!) {
|
||||
client_event(id: \$id) {
|
||||
$_eventFields
|
||||
}
|
||||
}
|
||||
|
||||
$fragments
|
||||
|
||||
''';
|
||||
|
||||
var nodeFragment = '''
|
||||
fragment node on EventEdge {
|
||||
node {
|
||||
$_eventsListFields
|
||||
}
|
||||
}
|
||||
''';
|
||||
|
||||
const String cancelClientEventMutation = r'''
|
||||
mutation cancel_client_event($event_id: ID!) {
|
||||
cancel_client_event(event_id: $event_id) {
|
||||
id
|
||||
}
|
||||
}
|
||||
''';
|
||||
|
||||
const String completeClientEventMutation = r'''
|
||||
mutation complete_client_event($event_id: ID!, $comment: String) {
|
||||
complete_client_event(event_id: $event_id, comment: $comment) {
|
||||
id
|
||||
}
|
||||
}
|
||||
''';
|
||||
|
||||
const String trackClientClockinMutation = r'''
|
||||
mutation track_client_clockin($position_staff_id: ID!) {
|
||||
track_client_clockin(position_staff_id: $position_staff_id) {
|
||||
id
|
||||
}
|
||||
}
|
||||
''';
|
||||
|
||||
const String trackClientClockoutMutation = r'''
|
||||
mutation track_client_clockout($position_staff_id: ID!) {
|
||||
track_client_clockout(position_staff_id: $position_staff_id) {
|
||||
id
|
||||
}
|
||||
}
|
||||
''';
|
||||
|
||||
const String notShowedPositionStaffMutation = r'''
|
||||
mutation not_showed_position_staff($position_staff_id: ID!) {
|
||||
not_showed_position_staff(position_staff_id: $position_staff_id) {
|
||||
id
|
||||
}
|
||||
}
|
||||
''';
|
||||
|
||||
const String replacePositionStaffMutation = r'''
|
||||
mutation replace_position_staff($position_staff_id: ID!, $reason: String!) {
|
||||
replace_position_staff(position_staff_id: $position_staff_id, reason: $reason) {
|
||||
id
|
||||
}
|
||||
}
|
||||
''';
|
||||
|
||||
String _eventsListFields = '''
|
||||
id
|
||||
business {
|
||||
id
|
||||
name
|
||||
registration
|
||||
avatar
|
||||
}
|
||||
hub {
|
||||
id
|
||||
name
|
||||
address
|
||||
}
|
||||
name
|
||||
status
|
||||
date
|
||||
start_time
|
||||
end_time
|
||||
purchase_order
|
||||
contract_type
|
||||
schedule_type
|
||||
''';
|
||||
|
||||
String _eventFields = '''
|
||||
id
|
||||
business {
|
||||
id
|
||||
name
|
||||
registration
|
||||
avatar
|
||||
...addons
|
||||
}
|
||||
hub {
|
||||
id
|
||||
name
|
||||
address
|
||||
}
|
||||
name
|
||||
status
|
||||
date
|
||||
start_time
|
||||
end_time
|
||||
purchase_order
|
||||
contract_type
|
||||
schedule_type
|
||||
additional_info
|
||||
addons {
|
||||
id
|
||||
name
|
||||
}
|
||||
tags {
|
||||
id
|
||||
name
|
||||
slug
|
||||
}
|
||||
...shifts
|
||||
|
||||
|
||||
''';
|
||||
|
||||
String fragments = '''fragment addons on Business {
|
||||
addons {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
|
||||
fragment shifts on Event {
|
||||
shifts {
|
||||
id
|
||||
name
|
||||
address
|
||||
...full_address
|
||||
contacts {
|
||||
id
|
||||
first_name
|
||||
last_name
|
||||
title
|
||||
...auth_info
|
||||
}
|
||||
positions {
|
||||
id
|
||||
count
|
||||
start_time
|
||||
end_time
|
||||
rate
|
||||
break
|
||||
...business_skill
|
||||
...staff
|
||||
department {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fragment auth_info on BusinessMember {
|
||||
auth_info {
|
||||
email
|
||||
phone
|
||||
}
|
||||
}
|
||||
|
||||
fragment business_skill on EventShiftPosition {
|
||||
business_skill {
|
||||
id
|
||||
skill {
|
||||
id
|
||||
name
|
||||
slug
|
||||
price
|
||||
}
|
||||
price
|
||||
is_active
|
||||
}
|
||||
}
|
||||
|
||||
fragment full_address on EventShift {
|
||||
full_address {
|
||||
street_number
|
||||
zip_code
|
||||
latitude
|
||||
longitude
|
||||
formatted_address
|
||||
street
|
||||
region
|
||||
city
|
||||
country
|
||||
}
|
||||
}
|
||||
|
||||
fragment staff on EventShiftPosition {
|
||||
staff {
|
||||
id
|
||||
first_name
|
||||
last_name
|
||||
middle_name
|
||||
email
|
||||
phone
|
||||
avatar
|
||||
pivot {
|
||||
id
|
||||
status
|
||||
start_at
|
||||
end_at
|
||||
clock_in
|
||||
clock_out
|
||||
...staff_position
|
||||
...cancel_reason
|
||||
rating {
|
||||
id
|
||||
rating
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fragment cancel_reason on EventShiftPositionStaff {
|
||||
cancel_reason {
|
||||
type
|
||||
reason
|
||||
details
|
||||
}
|
||||
}
|
||||
|
||||
fragment staff_position on EventShiftPositionStaff {
|
||||
position {
|
||||
id
|
||||
count
|
||||
start_time
|
||||
end_time
|
||||
rate
|
||||
break
|
||||
business_skill {
|
||||
id
|
||||
price
|
||||
skill{
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
}''';
|
||||
Reference in New Issue
Block a user