File size: 1,787 Bytes
eb0b2fd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
CREATE_COLLECTION = """
mutation CreateCollection(
    $route_id: Int!
    $recycler_id: Int!
    $driver_id: Int!
    $vehicle_id: Int!
    $branch_id: Int!
    $date: Prisma_DateTime!
    $estimated_containers: [Prisma_Json!]!
) {
    collection: createOneRecollections(
        data: {
            actual_collected_containers: { set: [] }
            actual_duration_min: null
            actual_volume_m3: null
            actual_weight_containers_kg: { set: [] }
            actual_weight_kg: null
            cat_route: { connect: { id: $route_id } }
            cliente_reciclador: {
                connect: { id: $recycler_id }
            }
            comments: null
            # counter: null
            date: $date
            drivers: { connect: { id: $driver_id } }
            enabled: true
            estimate_containers: {
                set: $estimated_containers
            }
            estimate_duration_min: null
            estimate_volume_m3: null
            estimate_weight_kg: { set: [] }
            materials: { set: [] }
            order: 0
            recollection_status: { connect: { id: 2 } }
            schedule_hr: { set: [] }
            sucursales: { connect: { id: $branch_id } }
            trucks: { connect: { id: $vehicle_id } }
        }
    ) {
        id
        created_at
    }
}
"""

DISABLE_COLLECTIONS_BY_DATE = """
mutation DisableCollectionsByDate(
    $recycler_id: Int!
    $date: Prisma_DateTime!
    $excluded_ids: [Int!]!
) {
    update_many_recollections: updateManyRecollections(
        data: { enabled: { set: false } }
        where: {
            id_cliente_reciclador: { equals: $recycler_id }
            date: { equals: $date }
            id: { notIn: $excluded_ids }
        }
    ) {
        count
    }
}
"""