@@ -19,31 +19,32 @@ impl UpdateDataInputFieldMapper {
19
19
impl DataInputFieldMapper for UpdateDataInputFieldMapper {
20
20
fn map_scalar < ' a > ( & self , ctx : & ' a QuerySchema , sf : ScalarFieldRef ) -> InputField < ' a > {
21
21
let base_update_type = match sf. type_identifier ( ) {
22
- TypeIdentifier :: Float => InputType :: object ( update_operations_object_type ( ctx, "Float" , sf. clone ( ) , true ) ) ,
22
+ TypeIdentifier :: Float => InputType :: object ( update_operations_object_type ( ctx, "Float" , sf. clone ( ) , true , false ) ) ,
23
23
TypeIdentifier :: Decimal => {
24
- InputType :: object ( update_operations_object_type ( ctx, "Decimal" , sf. clone ( ) , true ) )
24
+ InputType :: object ( update_operations_object_type ( ctx, "Decimal" , sf. clone ( ) , true , false ) )
25
25
}
26
- TypeIdentifier :: Int => InputType :: object ( update_operations_object_type ( ctx, "Int" , sf. clone ( ) , true ) ) ,
27
- TypeIdentifier :: BigInt => InputType :: object ( update_operations_object_type ( ctx, "BigInt" , sf. clone ( ) , true ) ) ,
26
+ TypeIdentifier :: Int => InputType :: object ( update_operations_object_type ( ctx, "Int" , sf. clone ( ) , true , false ) ) ,
27
+ TypeIdentifier :: BigInt => InputType :: object ( update_operations_object_type ( ctx, "BigInt" , sf. clone ( ) , true , false ) ) ,
28
28
TypeIdentifier :: String => {
29
- InputType :: object ( update_operations_object_type ( ctx, "String" , sf. clone ( ) , false ) )
29
+ InputType :: object ( update_operations_object_type ( ctx, "String" , sf. clone ( ) , false , false ) )
30
30
}
31
- TypeIdentifier :: Boolean => InputType :: object ( update_operations_object_type ( ctx, "Bool" , sf. clone ( ) , false ) ) ,
31
+ TypeIdentifier :: Boolean => InputType :: object ( update_operations_object_type ( ctx, "Bool" , sf. clone ( ) , false , false ) ) ,
32
32
TypeIdentifier :: Enum ( enum_id) => {
33
33
let enum_name = ctx. internal_data_model . walk ( enum_id) . name ( ) ;
34
34
InputType :: object ( update_operations_object_type (
35
35
ctx,
36
36
& format ! ( "Enum{enum_name}" ) ,
37
37
sf. clone ( ) ,
38
38
false ,
39
+ false ,
39
40
) )
40
41
}
41
42
TypeIdentifier :: Json => map_scalar_input_type_for_field ( ctx, & sf) ,
42
43
TypeIdentifier :: DateTime => {
43
- InputType :: object ( update_operations_object_type ( ctx, "DateTime" , sf. clone ( ) , false ) )
44
+ InputType :: object ( update_operations_object_type ( ctx, "DateTime" , sf. clone ( ) , false , true ) )
44
45
}
45
- TypeIdentifier :: UUID => InputType :: object ( update_operations_object_type ( ctx, "Uuid" , sf. clone ( ) , false ) ) ,
46
- TypeIdentifier :: Bytes => InputType :: object ( update_operations_object_type ( ctx, "Bytes" , sf. clone ( ) , false ) ) ,
46
+ TypeIdentifier :: UUID => InputType :: object ( update_operations_object_type ( ctx, "Uuid" , sf. clone ( ) , false , false ) ) ,
47
+ TypeIdentifier :: Bytes => InputType :: object ( update_operations_object_type ( ctx, "Bytes" , sf. clone ( ) , false , false ) ) ,
47
48
48
49
TypeIdentifier :: Unsupported => unreachable ! ( "No unsupported field should reach that path" ) ,
49
50
} ;
@@ -160,6 +161,7 @@ fn update_operations_object_type<'a>(
160
161
prefix : & str ,
161
162
sf : ScalarField ,
162
163
with_number_operators : bool ,
164
+ with_datetime_operators : bool ,
163
165
) -> InputObjectType < ' a > {
164
166
let ident = Identifier :: new_prisma ( IdentifierType :: FieldUpdateOperationsInput (
165
167
!sf. is_required ( ) ,
@@ -184,6 +186,10 @@ fn update_operations_object_type<'a>(
184
186
fields. push ( simple_input_field ( operations:: DIVIDE , typ, None ) . optional ( ) ) ;
185
187
}
186
188
189
+ if with_datetime_operators {
190
+ fields. push ( InputField :: new ( operations:: NOW . into ( ) , vec ! [ ] , None , false ) ) ;
191
+ }
192
+
187
193
if ctx. has_capability ( ConnectorCapability :: UndefinedType ) && !sf. is_required ( ) {
188
194
fields. push ( simple_input_field ( operations:: UNSET , InputType :: boolean ( ) , None ) . optional ( ) ) ;
189
195
}
0 commit comments