prisma_dart_generator 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,622 +0,0 @@
1
- //*** AUTO-GENERATED FILE - DO NOT MODIFY ***//
2
-
3
- enum UserRoleEnum {
4
- admin("ADMIN"),
5
- user("USER");
6
-
7
- final String _text;
8
-
9
- const UserRoleEnum(String text) : _text = text;
10
-
11
- static UserRoleEnum? fromText(String? value) {
12
- if (value == null) return null;
13
- try {
14
- return UserRoleEnum.values.firstWhere((v) => v._text == value);
15
- } catch (e) {
16
- return null;
17
- }
18
- }
19
-
20
- String get text => _text;
21
-
22
- @override
23
- String toString() => _text;
24
- }
25
-
26
- enum UserStatusEnum {
27
- active("ACTIVE"),
28
- inactive("INACTIVE"),
29
- pending("PENDING"),
30
- blocked("BLOCKED");
31
-
32
- final String _text;
33
-
34
- const UserStatusEnum(String text) : _text = text;
35
-
36
- static UserStatusEnum? fromText(String? value) {
37
- if (value == null) return null;
38
- try {
39
- return UserStatusEnum.values.firstWhere((v) => v._text == value);
40
- } catch (e) {
41
- return null;
42
- }
43
- }
44
-
45
- String get text => _text;
46
-
47
- @override
48
- String toString() => _text;
49
- }
50
-
51
- enum UserGenderEnum {
52
- male("MALE"),
53
- female("FEMALE"),
54
- other("OTHER");
55
-
56
- final String _text;
57
-
58
- const UserGenderEnum(String text) : _text = text;
59
-
60
- static UserGenderEnum? fromText(String? value) {
61
- if (value == null) return null;
62
- try {
63
- return UserGenderEnum.values.firstWhere((v) => v._text == value);
64
- } catch (e) {
65
- return null;
66
- }
67
- }
68
-
69
- String get text => _text;
70
-
71
- @override
72
- String toString() => _text;
73
- }
74
-
75
- enum UserSubscriptionEnum {
76
- free("FREE"),
77
- premium("PREMIUM"),
78
- enterprise("ENTERPRISE");
79
-
80
- final String _text;
81
-
82
- const UserSubscriptionEnum(String text) : _text = text;
83
-
84
- static UserSubscriptionEnum? fromText(String? value) {
85
- if (value == null) return null;
86
- try {
87
- return UserSubscriptionEnum.values.firstWhere((v) => v._text == value);
88
- } catch (e) {
89
- return null;
90
- }
91
- }
92
-
93
- String get text => _text;
94
-
95
- @override
96
- String toString() => _text;
97
- }
98
-
99
- class UserModel {
100
- final String? id;
101
- final String? name;
102
- final String? email;
103
- final String? password;
104
- final DateTime? createdat;
105
- final DateTime? updatedat;
106
- final List<PostModel>? posts;
107
- final List<UserProfileModel>? userprofiles;
108
-
109
- UserModel({
110
- this.id,
111
- this.name,
112
- this.email,
113
- this.password,
114
- this.createdat,
115
- this.updatedat,
116
- this.posts,
117
- this.userprofiles,
118
- });
119
-
120
- factory UserModel.fromJson(Map<String, dynamic> json) => UserModel(
121
- id: json["id"],
122
- name: json["name"],
123
- email: json["email"],
124
- password: json["password"],
125
- createdat: json["createdAt"] != null
126
- ? DateTime.parse(json["createdAt"])
127
- : null,
128
- updatedat: json["updatedAt"] != null
129
- ? DateTime.parse(json["updatedAt"])
130
- : null,
131
- posts: json["posts"] != null
132
- ? List.from(json["posts"]).map((d) => PostModel.fromJson(d)).toList()
133
- : null,
134
- userprofiles: json["userProfiles"] != null
135
- ? List.from(
136
- json["userProfiles"],
137
- ).map((d) => UserProfileModel.fromJson(d)).toList()
138
- : null,
139
- );
140
-
141
- Map<String, dynamic> toJson() => {
142
- if (id != null) 'id': id,
143
- if (name != null) 'name': name,
144
- if (email != null) 'email': email,
145
- if (password != null) 'password': password,
146
- if (createdat != null) 'createdAt': createdat?.toIso8601String(),
147
- if (updatedat != null) 'updatedAt': updatedat?.toIso8601String(),
148
- if (posts != null) 'posts': posts?.map((d) => d.toJson()).toList(),
149
- if (userprofiles != null)
150
- 'userProfiles': userprofiles?.map((d) => d.toJson()).toList(),
151
- };
152
-
153
- UserModel copyWith(Map<String, dynamic> json) => UserModel(
154
- id: json["id"] ?? id,
155
- name: json["name"] ?? name,
156
- email: json["email"] ?? email,
157
- password: json["password"] ?? password,
158
- createdat: json["createdAt"] != null
159
- ? DateTime.parse(json["createdAt"])
160
- : null,
161
- updatedat: json["updatedAt"] != null
162
- ? DateTime.parse(json["updatedAt"])
163
- : null,
164
- posts: json["posts"] != null
165
- ? List.from(json["posts"]).map((d) => PostModel.fromJson(d)).toList()
166
- : posts,
167
- userprofiles: json["userProfiles"] != null
168
- ? List.from(
169
- json["userProfiles"],
170
- ).map((d) => UserProfileModel.fromJson(d)).toList()
171
- : userprofiles,
172
- );
173
-
174
- @override
175
- String toString() =>
176
- """
177
- UserModel(
178
- 'id': ${id},
179
- 'name': ${name},
180
- 'email': ${email},
181
- 'password': ${password},
182
- 'createdAt': ${createdat?.toIso8601String()},
183
- 'updatedAt': ${updatedat?.toIso8601String()},
184
- 'posts': ${posts?.map((d) => d.toJson()).toList()},
185
- 'userProfiles': ${userprofiles?.map((d) => d.toJson()).toList()}
186
- ) """;
187
- }
188
-
189
- class PostModel {
190
- final String? id;
191
- final String? title;
192
- final String? content;
193
- final DateTime? createdat;
194
- final DateTime? updatedat;
195
- final String? authorid;
196
- final UserModel? author;
197
- final List<CommentModel>? comments;
198
- final CategoryModel? category;
199
- final String? categoryid;
200
- final TagModel? tag;
201
- final String? tagid;
202
- final List<ImageModel>? images;
203
-
204
- PostModel({
205
- this.id,
206
- this.title,
207
- this.content,
208
- this.createdat,
209
- this.updatedat,
210
- this.authorid,
211
- this.author,
212
- this.comments,
213
- this.category,
214
- this.categoryid,
215
- this.tag,
216
- this.tagid,
217
- this.images,
218
- });
219
-
220
- factory PostModel.fromJson(Map<String, dynamic> json) => PostModel(
221
- id: json["id"],
222
- title: json["title"],
223
- content: json["content"],
224
- createdat: json["createdAt"] != null
225
- ? DateTime.parse(json["createdAt"])
226
- : null,
227
- updatedat: json["updatedAt"] != null
228
- ? DateTime.parse(json["updatedAt"])
229
- : null,
230
- authorid: json["authorId"],
231
- author: json["author"] != null ? UserModel.fromJson(json['author']) : null,
232
- comments: json["comments"] != null
233
- ? List.from(
234
- json["comments"],
235
- ).map((d) => CommentModel.fromJson(d)).toList()
236
- : null,
237
- category: json["category"] != null
238
- ? CategoryModel.fromJson(json['category'])
239
- : null,
240
- categoryid: json["categoryId"],
241
- tag: json["tag"] != null ? TagModel.fromJson(json['tag']) : null,
242
- tagid: json["tagId"],
243
- images: json["images"] != null
244
- ? List.from(json["images"]).map((d) => ImageModel.fromJson(d)).toList()
245
- : null,
246
- );
247
-
248
- Map<String, dynamic> toJson() => {
249
- if (id != null) 'id': id,
250
- if (title != null) 'title': title,
251
- if (content != null) 'content': content,
252
- if (createdat != null) 'createdAt': createdat?.toIso8601String(),
253
- if (updatedat != null) 'updatedAt': updatedat?.toIso8601String(),
254
- if (authorid != null) 'authorId': authorid,
255
- if (author != null) 'author': author?.toJson(),
256
- if (comments != null) 'comments': comments?.map((d) => d.toJson()).toList(),
257
- if (category != null) 'category': category?.toJson(),
258
- if (categoryid != null) 'categoryId': categoryid,
259
- if (tag != null) 'tag': tag?.toJson(),
260
- if (tagid != null) 'tagId': tagid,
261
- if (images != null) 'images': images?.map((d) => d.toJson()).toList(),
262
- };
263
-
264
- PostModel copyWith(Map<String, dynamic> json) => PostModel(
265
- id: json["id"] ?? id,
266
- title: json["title"] ?? title,
267
- content: json["content"] ?? content,
268
- createdat: json["createdAt"] != null
269
- ? DateTime.parse(json["createdAt"])
270
- : null,
271
- updatedat: json["updatedAt"] != null
272
- ? DateTime.parse(json["updatedAt"])
273
- : null,
274
- authorid: json["authorId"] ?? authorid,
275
- author: json["author"] != null
276
- ? UserModel.fromJson(json['author'])
277
- : author,
278
- comments: json["comments"] != null
279
- ? List.from(
280
- json["comments"],
281
- ).map((d) => CommentModel.fromJson(d)).toList()
282
- : comments,
283
- category: json["category"] != null
284
- ? CategoryModel.fromJson(json['category'])
285
- : category,
286
- categoryid: json["categoryId"] ?? categoryid,
287
- tag: json["tag"] != null ? TagModel.fromJson(json['tag']) : tag,
288
- tagid: json["tagId"] ?? tagid,
289
- images: json["images"] != null
290
- ? List.from(json["images"]).map((d) => ImageModel.fromJson(d)).toList()
291
- : images,
292
- );
293
-
294
- @override
295
- String toString() =>
296
- """
297
- PostModel(
298
- 'id': ${id},
299
- 'title': ${title},
300
- 'content': ${content},
301
- 'createdAt': ${createdat?.toIso8601String()},
302
- 'updatedAt': ${updatedat?.toIso8601String()},
303
- 'authorId': ${authorid},
304
- 'author': ${author?.toJson()},
305
- 'comments': ${comments?.map((d) => d.toJson()).toList()},
306
- 'category': ${category?.toJson()},
307
- 'categoryId': ${categoryid},
308
- 'tag': ${tag?.toJson()},
309
- 'tagId': ${tagid},
310
- 'images': ${images?.map((d) => d.toJson()).toList()}
311
- ) """;
312
- }
313
-
314
- class CommentModel {
315
- final String? id;
316
- final String? content;
317
- final DateTime? createdat;
318
- final DateTime? updatedat;
319
- final String? postid;
320
- final PostModel? post;
321
-
322
- CommentModel({
323
- this.id,
324
- this.content,
325
- this.createdat,
326
- this.updatedat,
327
- this.postid,
328
- this.post,
329
- });
330
-
331
- factory CommentModel.fromJson(Map<String, dynamic> json) => CommentModel(
332
- id: json["id"],
333
- content: json["content"],
334
- createdat: json["createdAt"] != null
335
- ? DateTime.parse(json["createdAt"])
336
- : null,
337
- updatedat: json["updatedAt"] != null
338
- ? DateTime.parse(json["updatedAt"])
339
- : null,
340
- postid: json["postId"],
341
- post: json["post"] != null ? PostModel.fromJson(json['post']) : null,
342
- );
343
-
344
- Map<String, dynamic> toJson() => {
345
- if (id != null) 'id': id,
346
- if (content != null) 'content': content,
347
- if (createdat != null) 'createdAt': createdat?.toIso8601String(),
348
- if (updatedat != null) 'updatedAt': updatedat?.toIso8601String(),
349
- if (postid != null) 'postId': postid,
350
- if (post != null) 'post': post?.toJson(),
351
- };
352
-
353
- CommentModel copyWith(Map<String, dynamic> json) => CommentModel(
354
- id: json["id"] ?? id,
355
- content: json["content"] ?? content,
356
- createdat: json["createdAt"] != null
357
- ? DateTime.parse(json["createdAt"])
358
- : null,
359
- updatedat: json["updatedAt"] != null
360
- ? DateTime.parse(json["updatedAt"])
361
- : null,
362
- postid: json["postId"] ?? postid,
363
- post: json["post"] != null ? PostModel.fromJson(json['post']) : post,
364
- );
365
-
366
- @override
367
- String toString() =>
368
- """
369
- CommentModel(
370
- 'id': ${id},
371
- 'content': ${content},
372
- 'createdAt': ${createdat?.toIso8601String()},
373
- 'updatedAt': ${updatedat?.toIso8601String()},
374
- 'postId': ${postid},
375
- 'post': ${post?.toJson()}
376
- ) """;
377
- }
378
-
379
- class CategoryModel {
380
- final String? id;
381
- final String? name;
382
- final DateTime? createdat;
383
- final DateTime? updatedat;
384
- final List<PostModel>? posts;
385
-
386
- CategoryModel({
387
- this.id,
388
- this.name,
389
- this.createdat,
390
- this.updatedat,
391
- this.posts,
392
- });
393
-
394
- factory CategoryModel.fromJson(Map<String, dynamic> json) => CategoryModel(
395
- id: json["id"],
396
- name: json["name"],
397
- createdat: json["createdAt"] != null
398
- ? DateTime.parse(json["createdAt"])
399
- : null,
400
- updatedat: json["updatedAt"] != null
401
- ? DateTime.parse(json["updatedAt"])
402
- : null,
403
- posts: json["posts"] != null
404
- ? List.from(json["posts"]).map((d) => PostModel.fromJson(d)).toList()
405
- : null,
406
- );
407
-
408
- Map<String, dynamic> toJson() => {
409
- if (id != null) 'id': id,
410
- if (name != null) 'name': name,
411
- if (createdat != null) 'createdAt': createdat?.toIso8601String(),
412
- if (updatedat != null) 'updatedAt': updatedat?.toIso8601String(),
413
- if (posts != null) 'posts': posts?.map((d) => d.toJson()).toList(),
414
- };
415
-
416
- CategoryModel copyWith(Map<String, dynamic> json) => CategoryModel(
417
- id: json["id"] ?? id,
418
- name: json["name"] ?? name,
419
- createdat: json["createdAt"] != null
420
- ? DateTime.parse(json["createdAt"])
421
- : null,
422
- updatedat: json["updatedAt"] != null
423
- ? DateTime.parse(json["updatedAt"])
424
- : null,
425
- posts: json["posts"] != null
426
- ? List.from(json["posts"]).map((d) => PostModel.fromJson(d)).toList()
427
- : posts,
428
- );
429
-
430
- @override
431
- String toString() =>
432
- """
433
- CategoryModel(
434
- 'id': ${id},
435
- 'name': ${name},
436
- 'createdAt': ${createdat?.toIso8601String()},
437
- 'updatedAt': ${updatedat?.toIso8601String()},
438
- 'posts': ${posts?.map((d) => d.toJson()).toList()}
439
- ) """;
440
- }
441
-
442
- class TagModel {
443
- final String? id;
444
- final String? name;
445
- final DateTime? createdat;
446
- final DateTime? updatedat;
447
- final List<PostModel>? posts;
448
-
449
- TagModel({this.id, this.name, this.createdat, this.updatedat, this.posts});
450
-
451
- factory TagModel.fromJson(Map<String, dynamic> json) => TagModel(
452
- id: json["id"],
453
- name: json["name"],
454
- createdat: json["createdAt"] != null
455
- ? DateTime.parse(json["createdAt"])
456
- : null,
457
- updatedat: json["updatedAt"] != null
458
- ? DateTime.parse(json["updatedAt"])
459
- : null,
460
- posts: json["posts"] != null
461
- ? List.from(json["posts"]).map((d) => PostModel.fromJson(d)).toList()
462
- : null,
463
- );
464
-
465
- Map<String, dynamic> toJson() => {
466
- if (id != null) 'id': id,
467
- if (name != null) 'name': name,
468
- if (createdat != null) 'createdAt': createdat?.toIso8601String(),
469
- if (updatedat != null) 'updatedAt': updatedat?.toIso8601String(),
470
- if (posts != null) 'posts': posts?.map((d) => d.toJson()).toList(),
471
- };
472
-
473
- TagModel copyWith(Map<String, dynamic> json) => TagModel(
474
- id: json["id"] ?? id,
475
- name: json["name"] ?? name,
476
- createdat: json["createdAt"] != null
477
- ? DateTime.parse(json["createdAt"])
478
- : null,
479
- updatedat: json["updatedAt"] != null
480
- ? DateTime.parse(json["updatedAt"])
481
- : null,
482
- posts: json["posts"] != null
483
- ? List.from(json["posts"]).map((d) => PostModel.fromJson(d)).toList()
484
- : posts,
485
- );
486
-
487
- @override
488
- String toString() =>
489
- """
490
- TagModel(
491
- 'id': ${id},
492
- 'name': ${name},
493
- 'createdAt': ${createdat?.toIso8601String()},
494
- 'updatedAt': ${updatedat?.toIso8601String()},
495
- 'posts': ${posts?.map((d) => d.toJson()).toList()}
496
- ) """;
497
- }
498
-
499
- class ImageModel {
500
- final String? id;
501
- final String? url;
502
- final DateTime? createdat;
503
- final DateTime? updatedat;
504
- final String? postid;
505
- final PostModel? post;
506
-
507
- ImageModel({
508
- this.id,
509
- this.url,
510
- this.createdat,
511
- this.updatedat,
512
- this.postid,
513
- this.post,
514
- });
515
-
516
- factory ImageModel.fromJson(Map<String, dynamic> json) => ImageModel(
517
- id: json["id"],
518
- url: json["url"],
519
- createdat: json["createdAt"] != null
520
- ? DateTime.parse(json["createdAt"])
521
- : null,
522
- updatedat: json["updatedAt"] != null
523
- ? DateTime.parse(json["updatedAt"])
524
- : null,
525
- postid: json["postId"],
526
- post: json["post"] != null ? PostModel.fromJson(json['post']) : null,
527
- );
528
-
529
- Map<String, dynamic> toJson() => {
530
- if (id != null) 'id': id,
531
- if (url != null) 'url': url,
532
- if (createdat != null) 'createdAt': createdat?.toIso8601String(),
533
- if (updatedat != null) 'updatedAt': updatedat?.toIso8601String(),
534
- if (postid != null) 'postId': postid,
535
- if (post != null) 'post': post?.toJson(),
536
- };
537
-
538
- ImageModel copyWith(Map<String, dynamic> json) => ImageModel(
539
- id: json["id"] ?? id,
540
- url: json["url"] ?? url,
541
- createdat: json["createdAt"] != null
542
- ? DateTime.parse(json["createdAt"])
543
- : null,
544
- updatedat: json["updatedAt"] != null
545
- ? DateTime.parse(json["updatedAt"])
546
- : null,
547
- postid: json["postId"] ?? postid,
548
- post: json["post"] != null ? PostModel.fromJson(json['post']) : post,
549
- );
550
-
551
- @override
552
- String toString() =>
553
- """
554
- ImageModel(
555
- 'id': ${id},
556
- 'url': ${url},
557
- 'createdAt': ${createdat?.toIso8601String()},
558
- 'updatedAt': ${updatedat?.toIso8601String()},
559
- 'postId': ${postid},
560
- 'post': ${post?.toJson()}
561
- ) """;
562
- }
563
-
564
- class UserProfileModel {
565
- final String? id;
566
- final String? userid;
567
- final UserModel? user;
568
- final DateTime? createdat;
569
- final DateTime? updatedat;
570
-
571
- UserProfileModel({
572
- this.id,
573
- this.userid,
574
- this.user,
575
- this.createdat,
576
- this.updatedat,
577
- });
578
-
579
- factory UserProfileModel.fromJson(Map<String, dynamic> json) =>
580
- UserProfileModel(
581
- id: json["id"],
582
- userid: json["userId"],
583
- user: json["user"] != null ? UserModel.fromJson(json['user']) : null,
584
- createdat: json["createdAt"] != null
585
- ? DateTime.parse(json["createdAt"])
586
- : null,
587
- updatedat: json["updatedAt"] != null
588
- ? DateTime.parse(json["updatedAt"])
589
- : null,
590
- );
591
-
592
- Map<String, dynamic> toJson() => {
593
- if (id != null) 'id': id,
594
- if (userid != null) 'userId': userid,
595
- if (user != null) 'user': user?.toJson(),
596
- if (createdat != null) 'createdAt': createdat?.toIso8601String(),
597
- if (updatedat != null) 'updatedAt': updatedat?.toIso8601String(),
598
- };
599
-
600
- UserProfileModel copyWith(Map<String, dynamic> json) => UserProfileModel(
601
- id: json["id"] ?? id,
602
- userid: json["userId"] ?? userid,
603
- user: json["user"] != null ? UserModel.fromJson(json['user']) : user,
604
- createdat: json["createdAt"] != null
605
- ? DateTime.parse(json["createdAt"])
606
- : null,
607
- updatedat: json["updatedAt"] != null
608
- ? DateTime.parse(json["updatedAt"])
609
- : null,
610
- );
611
-
612
- @override
613
- String toString() =>
614
- """
615
- UserProfileModel(
616
- 'id': ${id},
617
- 'userId': ${userid},
618
- 'user': ${user?.toJson()},
619
- 'createdAt': ${createdat?.toIso8601String()},
620
- 'updatedAt': ${updatedat?.toIso8601String()}
621
- ) """;
622
- }