@@ -280,12 +280,11 @@ class Post extends Model {
280
280
static final QueryField LIKECOUNT = QueryField (fieldName: "likeCount" );
281
281
static final QueryField BLOG = QueryField (
282
282
fieldName: "blog" ,
283
- fieldType: ModelFieldType (ModelFieldTypeEnum .model,
284
- ofModelName: (Blog ).toString ()));
283
+ fieldType: ModelFieldType (ModelFieldTypeEnum .model, ofModelName: 'Blog' ));
285
284
static final QueryField COMMENTS = QueryField (
286
285
fieldName: "comments" ,
287
- fieldType: ModelFieldType ( ModelFieldTypeEnum .model,
288
- ofModelName: ( Comment ). toString () ));
286
+ fieldType:
287
+ ModelFieldType ( ModelFieldTypeEnum .model, ofModelName: ' Comment' ));
289
288
static var schema =
290
289
Model .defineSchema (define: (ModelSchemaDefinition modelSchemaDefinition) {
291
290
modelSchemaDefinition.name = "Post" ;
@@ -320,16 +319,13 @@ class Post extends Model {
320
319
modelSchemaDefinition.addField (ModelFieldDefinition .belongsTo (
321
320
key: Post .BLOG ,
322
321
isRequired: false ,
323
- // TODO(Jordan-Nelson): Remove `targetName` when API category has been
324
- // updated to support CPK changes. This was added manually.
325
- targetName: "blogID" ,
326
- targetNames: ["blogID" ],
327
- ofModelName: (Blog ).toString ()));
322
+ targetNames: ['blogID' ],
323
+ ofModelName: 'Blog' ));
328
324
329
325
modelSchemaDefinition.addField (ModelFieldDefinition .hasMany (
330
326
key: Post .COMMENTS ,
331
327
isRequired: false ,
332
- ofModelName: ( Comment ). toString () ,
328
+ ofModelName: ' Comment' ,
333
329
associatedKey: Comment .POST ));
334
330
335
331
modelSchemaDefinition.addField (ModelFieldDefinition .nonQueryField (
@@ -353,6 +349,11 @@ class _PostModelType extends ModelType<Post> {
353
349
Post fromJson (Map <String , dynamic > jsonData) {
354
350
return Post .fromJson (jsonData);
355
351
}
352
+
353
+ @override
354
+ String modelName () {
355
+ return 'Post' ;
356
+ }
356
357
}
357
358
358
359
/// This is an auto generated class representing the model identifier
0 commit comments