jitera_proto 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,776 @@
1
+ syntax = "proto3";
2
+ package schema.v1;
3
+
4
+ message Project {
5
+ string id = 1;
6
+ string project_name = 2;
7
+ int32 project_id = 3;
8
+ optional Infra infra = 4;
9
+
10
+ oneof generate_type {
11
+ ProjectExport project_export = 9;
12
+ ProjectPreview project_preview = 10;
13
+ }
14
+ }
15
+
16
+ message ProjectExport {
17
+ int32 id = 1;
18
+ }
19
+
20
+ message ProjectPreview {
21
+ int32 id = 1;
22
+ }
23
+
24
+ message Infra {
25
+ string path = 1;
26
+ }
27
+
28
+ message Backend {
29
+ repeated Table tables = 4;
30
+ repeated Controller controllers = 5;
31
+ repeated Feature features = 6;
32
+ repeated Authorization authorizations = 7;
33
+ repeated Localization localizations = 8;
34
+ repeated Migration migrations = 9;
35
+ }
36
+
37
+ message Localization {
38
+ string lang = 1;
39
+ repeated Namespace namespaces = 3;
40
+
41
+ message Namespace {
42
+ string name = 1;
43
+ repeated Translate translates = 2;
44
+ }
45
+
46
+ message Translate {
47
+ string key = 1;
48
+ string value = 2;
49
+ }
50
+ }
51
+
52
+ enum DataTypeName {
53
+ BOOLEAN = 0;
54
+ INTEGER = 1;
55
+ FLOAT = 2;
56
+ STRING = 3;
57
+ TEXT = 4;
58
+ DATE = 5;
59
+ DATETIME = 6;
60
+ ARRAY = 7;
61
+ OBJECT = 8;
62
+ PAGE_SIZE = 9;
63
+ PAGE_NUMBER = 10;
64
+ FILE = 11;
65
+ TABLE = 12;
66
+ ENUM = 13;
67
+ CURRENT_USER=14;
68
+ }
69
+
70
+ message DataType {
71
+ DataTypeName name = 1;
72
+ }
73
+
74
+ enum Operator {
75
+ WHERE = 0;
76
+ PAGINATION = 1;
77
+ ORDER = 2;
78
+
79
+ ORDER_ASC = 3;
80
+ ORDER_DESC = 4;
81
+
82
+ JOIN_AND = 5;
83
+ JOIN_OR = 6;
84
+
85
+ EQUAL = 7;
86
+ START_WITH = 8;
87
+ END_WITH = 9;
88
+ CONTAIN = 10;
89
+ NOT_EQUAL = 11;
90
+ GREATER_THAN = 12;
91
+ LESS_THAN = 13;
92
+ GREATER_OR_EQUAL_THAN = 14;
93
+ LESS_OR_EQUAL_THAN = 15;
94
+
95
+ WHERE_AND = 16;
96
+ WHERE_OR = 17;
97
+ }
98
+
99
+ message Authorization {
100
+ string name = 1;
101
+ int32 id = 2;
102
+ repeated Policy policies = 3;
103
+
104
+ message Policy {
105
+ string resource = 3;
106
+ RoleBinding role_binding = 4;
107
+ Rule rule = 5;
108
+ Scope scope = 6;
109
+
110
+ message RoleBinding {
111
+ string table = 1;
112
+ string column = 2;
113
+ string role = 3;
114
+ }
115
+
116
+ enum Scope {
117
+ ALL = 0;
118
+ ASSOCIATED = 1;
119
+ }
120
+
121
+ message Rule {
122
+ repeated Operand operands = 1;
123
+ repeated Operator operators = 2;
124
+
125
+ message Operand {
126
+ oneof operand {
127
+ Expr expr = 1;
128
+ Rule rule = 2;
129
+ }
130
+ }
131
+
132
+ message Expr {
133
+ string column = 1;
134
+ oneof map_to {
135
+ string value = 2;
136
+ string paths = 3;
137
+ }
138
+ DataType data_type = 4;
139
+ Operator operator = 5;
140
+ }
141
+ }
142
+ }
143
+ }
144
+
145
+ message Feature {
146
+ FeatureName name = 1;
147
+ Environment env = 2;
148
+ oneof types {
149
+ EmailLogin email_login = 3;
150
+ JPBankData jp_bank_data = 4;
151
+ BasicAuth basic_auth = 5;
152
+ TwilioLogin twilio_login = 6;
153
+ Rollbar rollbar = 7;
154
+ DeepLink deep_link = 8;
155
+ Stripe stripe = 9;
156
+ LineLogin line_login = 10;
157
+ }
158
+
159
+ message EmailLogin {
160
+ repeated string tables = 1;
161
+ int32 password_min_length = 2;
162
+ int32 remember_for = 3;
163
+ int32 reset_password_within = 4;
164
+ int32 maximum_retries = 5;
165
+ UnlockStrategy unlock_strategy = 6;
166
+ int32 unlock_in = 7;
167
+ string password_regex = 8;
168
+ bool confirmation_email = 9;
169
+
170
+ enum UnlockStrategy {
171
+ TIME = 0;
172
+ EMAIL = 1;
173
+ BOTH = 2;
174
+ }
175
+ }
176
+
177
+ message JPBankData { }
178
+
179
+ message BasicAuth {
180
+ string username = 1;
181
+ string password = 2;
182
+ }
183
+
184
+ message TwilioLogin {
185
+ repeated string user_tables = 1;
186
+ string service_id = 2;
187
+ string sid = 3;
188
+ string token = 4;
189
+ int32 otp_length = 5;
190
+ }
191
+
192
+ message Rollbar {
193
+ string access_token = 1;
194
+ }
195
+
196
+ message DeepLink {
197
+ string ios_app_store_id = 1;
198
+ string ios_bundle_id = 2;
199
+ string ios_app_link = 3;
200
+ string android_package_name = 4;
201
+ string android_cert_fingerprints = 5;
202
+ string android_app_link = 6;
203
+ string firebase_domain = 7;
204
+ }
205
+
206
+ message Stripe {
207
+ repeated string subscription_tables = 1;
208
+ repeated string user_tables = 2;
209
+ string public_key = 3;
210
+ string secret_key = 4;
211
+ string stripe_endpoint_secret = 5;
212
+ string http_stripe_signature = 6;
213
+ bool add_stripe_subscription = 7;
214
+ bool add_charge_api = 8;
215
+ bool add_intent_api = 9;
216
+ }
217
+
218
+ message LineLogin {
219
+ repeated string user_tables = 1;
220
+ string client_id = 2;
221
+ string secret_key = 3;
222
+ }
223
+
224
+ enum FeatureName {
225
+ EMAIL_LOGIN = 0;
226
+ JP_BANKS_DATA = 1;
227
+ BASIC_AUTH = 2;
228
+ TWILIO_LOGIN = 3;
229
+ ROLLBAR = 4;
230
+ DEEP_LINK = 5;
231
+ STRIPE = 6;
232
+ LINE_LOGIN = 7;
233
+ }
234
+
235
+ enum Environment {
236
+ DEVELOPMENT = 0;
237
+ STAGING = 1;
238
+ PRODUCTION = 2;
239
+ ALL = 3;
240
+ }
241
+ }
242
+
243
+ message Controller {
244
+ string name = 1;
245
+ repeated Endpoint endpoints = 2;
246
+
247
+ message Endpoint {
248
+ string path = 1;
249
+ string name = 2;
250
+ oneof resource {
251
+ string table = 3;
252
+ Feature.FeatureName feature = 4;
253
+ }
254
+ oneof methods {
255
+ List list = 5;
256
+ Get get = 6;
257
+ Create create = 7;
258
+ Update update = 8;
259
+ Delete delete = 9;
260
+ }
261
+ Authentication authentication = 10;
262
+ Authorization authorization = 11;
263
+ Response responses = 12;
264
+ RequestContent params = 13;
265
+ bool writable = 14;
266
+
267
+ message List {
268
+ RequestContent queries = 1;
269
+ ResourceCondition conditions = 2;
270
+ }
271
+
272
+ message Get {
273
+ RequestContent queries = 1;
274
+ ResourceCondition conditions = 2;
275
+ }
276
+
277
+ message Create {
278
+ RequestContent body = 1;
279
+ ResourceCondition conditions = 2;
280
+ ResourceUpdate resources = 3;
281
+ }
282
+
283
+ message Update {
284
+ RequestContent body = 1;
285
+ ResourceCondition conditions = 2;
286
+ ResourceUpdate resources = 3;
287
+ }
288
+
289
+ message Delete {
290
+ RequestContent body = 1;
291
+ ResourceCondition conditions = 2;
292
+ }
293
+ }
294
+
295
+ message RequestContent {
296
+ repeated Field fields = 1;
297
+
298
+ message Field {
299
+ string name = 1;
300
+ DataType data_type = 2;
301
+ repeated Field children = 3;
302
+ }
303
+ }
304
+
305
+ message Response {
306
+ repeated Field fields = 1;
307
+
308
+ message Field {
309
+ string name = 1;
310
+ oneof map_to {
311
+ string resource = 2;
312
+ string property = 3;
313
+ string value = 4;
314
+ }
315
+ DataType data_type = 5;
316
+ repeated Field children = 6;
317
+ string category = 7;
318
+ }
319
+ }
320
+
321
+ message ResourceCondition {
322
+ repeated Operand operands = 1;
323
+ repeated Operator operators = 2;
324
+
325
+ message Operand {
326
+ oneof operand {
327
+ Expr expr = 1;
328
+ ResourceCondition condition = 2;
329
+ }
330
+ }
331
+
332
+ message Expr {
333
+ repeated string paths = 1;
334
+ oneof map_to {
335
+ string query = 2;
336
+ string params = 3;
337
+ string body = 4;
338
+ string value = 5;
339
+ System system = 7;
340
+ }
341
+ DataType data_type = 8;
342
+ Operator operator = 9;
343
+ }
344
+
345
+ enum System {
346
+ RESOURCE_OWNER = 0;
347
+ }
348
+ }
349
+
350
+ message ResourceUpdate {
351
+ repeated Field fields = 1;
352
+
353
+ message Field {
354
+ string name = 1;
355
+ oneof map_to {
356
+ string query = 2;
357
+ string params = 3;
358
+ string body = 4;
359
+ string value = 5;
360
+ }
361
+ DataType data_type = 6;
362
+ repeated Field children = 7;
363
+ }
364
+ }
365
+
366
+ message Authentication {
367
+ string table_name = 1;
368
+ }
369
+
370
+ message Authorization {
371
+ int32 authorization_id = 1;
372
+ string table_name = 2;
373
+ }
374
+ }
375
+
376
+ message Table {
377
+ string name = 1;
378
+ repeated Column columns = 2;
379
+ repeated Relation relations = 3;
380
+ repeated Index indexes = 4;
381
+
382
+ message Column {
383
+ string name = 1;
384
+ ColumnType type = 2;
385
+ repeated Constraint constraints = 3;
386
+
387
+ message ColumnType {
388
+ oneof types {
389
+ IntegerType integer_type = 1;
390
+ StringType string_type = 2;
391
+ FloatType float_type = 3;
392
+ BooleanType boolean_type = 4;
393
+ DateType date_type = 5;
394
+ FileType file_type = 6;
395
+ EnumType enum_type = 7;
396
+ }
397
+ }
398
+
399
+ message StringType {
400
+ optional string default_value = 1;
401
+ bool is_text = 2;
402
+ repeated Format formats = 3;
403
+ repeated Condition conditions = 4;
404
+
405
+ enum Format {
406
+ EMAIL = 0;
407
+ HIRAGANA = 1;
408
+ KATAKANA = 2;
409
+ PHONE_NUMBER = 3;
410
+ URL = 4;
411
+ }
412
+
413
+ message Condition {
414
+ Operator operator = 1;
415
+ oneof operand {
416
+ int32 value = 2;
417
+ string column_name = 3;
418
+ }
419
+ }
420
+ }
421
+
422
+ message IntegerType {
423
+ optional int32 default_value = 1;
424
+ repeated Condition conditions = 2;
425
+
426
+ message Condition {
427
+ Operator operator = 1;
428
+ oneof operand {
429
+ int32 value = 2;
430
+ string column_name = 3;
431
+ }
432
+ }
433
+ }
434
+
435
+ enum Operator {
436
+ GREATER_THAN = 0;
437
+ GREATER_THAN_OR_EQUAL = 1;
438
+ EQUAL = 2;
439
+ LESS_THAN = 3;
440
+ LESS_THAN_OR_EQUAL = 4;
441
+ NOT_EQUAL = 5;
442
+ }
443
+
444
+ message FloatType {
445
+ optional float default_value = 1;
446
+ repeated Condition conditions = 2;
447
+
448
+ message Condition {
449
+ Operator operator = 1;
450
+ oneof operand {
451
+ float value = 2;
452
+ string column_name = 3;
453
+ }
454
+ }
455
+ }
456
+
457
+ message BooleanType {
458
+ bool default_value = 1;
459
+ }
460
+
461
+ message DateType {
462
+ bool with_time = 1;
463
+ repeated Condition conditions = 2;
464
+
465
+ enum Condition {
466
+ IN_PAST = 0;
467
+ IN_FUTURE = 1;
468
+ }
469
+ }
470
+
471
+ message FileType {
472
+ int32 maximum_size = 1;
473
+ NumberOfFiles number_of_files = 2;
474
+ repeated ContentType content_types = 3;
475
+ bool multiple = 4;
476
+
477
+
478
+ enum ContentType {
479
+ IMAGE = 0;
480
+ VIDEO = 1;
481
+ AUDIO = 2;
482
+ CSV = 3;
483
+ PDF = 4;
484
+ JSON = 5;
485
+ }
486
+
487
+ message NumberOfFiles {
488
+ int32 minimum = 1;
489
+ int32 maximum = 2;
490
+ }
491
+ }
492
+
493
+ message EnumType {
494
+ string default_value = 1;
495
+ repeated string values = 2;
496
+ }
497
+ }
498
+
499
+ message Constraint {
500
+ oneof relation_key {
501
+ PrimaryKey primary_key = 1;
502
+ ForeignKey foreign_key = 2;
503
+ NotNull not_null = 3;
504
+ Unique unique = 4;
505
+ }
506
+
507
+ message PrimaryKey {
508
+ }
509
+
510
+ message ForeignKey {
511
+ string table_name = 1;
512
+ string primary_key = 2;
513
+ }
514
+
515
+ message NotNull {
516
+ }
517
+
518
+ message Unique {
519
+ }
520
+ }
521
+
522
+ message Index {
523
+ string name = 1;
524
+ bool unique = 2;
525
+ repeated string columns = 3;
526
+ }
527
+
528
+ message Relation {
529
+ oneof relation_type {
530
+ RelationHasOne has_one = 1;
531
+ RelationBelongTo belong_to = 2;
532
+ RelationOneMany one_many = 3;
533
+ RelationManyOne many_one = 4;
534
+ RelationManyMany many_many = 5;
535
+ }
536
+
537
+ message RelationHasOne {
538
+ string table_name = 1;
539
+ string column_name = 2;
540
+ }
541
+
542
+ message RelationBelongTo {
543
+ string table_name = 1;
544
+ string column_name = 2;
545
+ }
546
+
547
+ message RelationManyOne {
548
+ string table_name = 1;
549
+ string column_name = 2;
550
+ }
551
+
552
+ message RelationOneMany {
553
+ string table_name = 1;
554
+ string column_name = 2;
555
+ }
556
+
557
+ message RelationManyMany {
558
+ string table_name = 1;
559
+ string joined_name = 2;
560
+ }
561
+ }
562
+ }
563
+ message Migration {
564
+ string migration_id = 1;
565
+ repeated MigrationChange changes = 2;
566
+ }
567
+ message MigrationChange {
568
+ oneof methods {
569
+ CreateTable create_table = 1;
570
+ ChangeTableName change_table_name = 2;
571
+ ChangeTableComment change_table_comment = 3;
572
+ AddColumn add_column = 4;
573
+ RenameColumn rename_column = 5;
574
+ ChangeColumnComment change_column_comment = 6;
575
+ ChangeColumn change_column = 7;
576
+ ChangeColumnDefault change_column_default = 8;
577
+ ChangeColumnNull change_column_null = 9;
578
+ RemoveTableIndex remove_table_index = 10;
579
+ RemoveTableRelation remove_table_relation = 11;
580
+ CreateTableRelation create_table_relation = 12;
581
+ RemoveColumn remove_column = 13;
582
+ DropTable drop_table = 14;
583
+ ChangeTableIndex change_table_index = 15;
584
+ CreateTableIndex create_table_index = 16;
585
+ AddUniqColumn add_uniq_column = 17;
586
+ ChangeColumnUnique change_column_unique = 18;
587
+ }
588
+ }
589
+ message CreateTable {
590
+ string key = 1;
591
+ CreateTableChange change_to = 2;
592
+ string prev_uuid = 3;
593
+ string next_uuid = 4;
594
+ CreateTableNextRecord next_record = 5;
595
+ }
596
+ message ChangeTableName {
597
+ string key = 1;
598
+ string change_from = 2;
599
+ string change_to = 3;
600
+ string prev_uuid = 4;
601
+ string next_uuid = 5;
602
+ CreateTableNextRecord prev_record = 6;
603
+ CreateTableNextRecord next_record = 7;
604
+ }
605
+ message ChangeTableComment {
606
+ string key = 1;
607
+ string change_from = 2;
608
+ string change_to = 3;
609
+ string prev_uuid = 4;
610
+ string next_uuid = 5;
611
+ CreateTableNextRecord prev_record = 6;
612
+ CreateTableNextRecord next_record = 7;
613
+ }
614
+ message CreateTableChange {
615
+ string name = 1;
616
+ string uuid = 2;
617
+ optional string comment = 3;
618
+ }
619
+ message AddColumn {
620
+ string key = 1;
621
+ MigrationColumnDefinition change_to = 2;
622
+ string prev_uuid = 3;
623
+ string next_uuid = 4;
624
+ MigrationColumnDefinition next_record = 5;
625
+ }
626
+ message RenameColumn {
627
+ string key = 1;
628
+ string change_from = 2;
629
+ string change_to = 3;
630
+ string prev_uuid = 4;
631
+ string next_uuid = 5;
632
+ MigrationColumnDefinition prev_record = 6;
633
+ MigrationColumnDefinition next_record = 7;
634
+ }
635
+ message ChangeColumnComment {
636
+ string key = 1;
637
+ string change_from = 2;
638
+ string change_to = 3;
639
+ string prev_uuid = 4;
640
+ string next_uuid = 5;
641
+ MigrationColumnDefinition prev_record = 6;
642
+ MigrationColumnDefinition next_record = 7;
643
+ }
644
+ message ChangeColumn {
645
+ string key = 1;
646
+ string change_from = 2;
647
+ string change_to = 3;
648
+ string prev_uuid = 4;
649
+ string next_uuid = 5;
650
+ MigrationColumnDefinition prev_record = 6;
651
+ MigrationColumnDefinition next_record = 7;
652
+ }
653
+ message ChangeColumnDefault {
654
+ string key = 1;
655
+ string change_from = 2;
656
+ string change_to = 3;
657
+ string prev_uuid = 4;
658
+ string next_uuid = 5;
659
+ MigrationColumnDefinition prev_record = 6;
660
+ MigrationColumnDefinition next_record = 7;
661
+ }
662
+ message ChangeColumnNull {
663
+ string key = 1;
664
+ string change_from = 2;
665
+ string change_to = 3;
666
+ string prev_uuid = 4;
667
+ string next_uuid = 5;
668
+ MigrationColumnDefinition prev_record = 6;
669
+ MigrationColumnDefinition next_record = 7;
670
+ }
671
+ message RemoveTableIndex {
672
+ string key = 1;
673
+ TableIndexMigration change_from = 2;
674
+ string prev_uuid = 3;
675
+ string next_uuid = 4;
676
+ TableIndexMigration prev_record = 5;
677
+ }
678
+ message RemoveTableRelation {
679
+ string key = 1;
680
+ string prev_uuid = 3;
681
+ string next_uuid = 4;
682
+ TableRelationMigration prev_record = 5;
683
+ }
684
+ message CreateTableRelation {
685
+ string key = 1;
686
+ TableRelationMigration change_to = 2;
687
+ string prev_uuid = 4;
688
+ string next_uuid = 5;
689
+ TableRelationMigration next_record = 6;
690
+ }
691
+ message RemoveColumn {
692
+ string key = 1;
693
+ MigrationColumnDefinition change_from = 2;
694
+ string prev_uuid = 4;
695
+ string next_uuid = 5;
696
+ MigrationColumnDefinition prev_record = 6;
697
+ }
698
+ message DropTable {
699
+ string key = 1;
700
+ CreateTableNextRecord change_from = 2;
701
+ string prev_uuid = 4;
702
+ string next_uuid = 5;
703
+ CreateTableNextRecord prev_record = 6;
704
+ }
705
+ message ChangeTableIndex {
706
+ string key = 1;
707
+ string change_from = 2;
708
+ string change_to = 3;
709
+ string prev_uuid = 4;
710
+ string next_uuid = 5;
711
+ TableIndexMigration prev_record = 6;
712
+ TableIndexMigration next_record = 7;
713
+ }
714
+ message CreateTableIndex {
715
+ string key = 1;
716
+ TableIndexMigration change_to = 2;
717
+ string next_uuid = 5;
718
+ TableIndexMigration next_record = 7;
719
+ }
720
+ message AddUniqColumn {
721
+ MigrationColumnDefinition next_record = 7;
722
+ }
723
+ message ChangeColumnUnique {
724
+ string key = 1;
725
+ bool change_from = 2;
726
+ bool change_to = 3;
727
+ string prev_uuid = 4;
728
+ string next_uuid = 5;
729
+ MigrationColumnDefinition prev_record = 6;
730
+ MigrationColumnDefinition next_record = 7;
731
+ }
732
+ message CreateTableNextRecord {
733
+ string name = 1;
734
+ string uuid = 2;
735
+ string comment = 3;
736
+ repeated MigrationColumnDefinition column_definitions = 4;
737
+ }
738
+ message MigrationColumnDefinition {
739
+ string name = 1;
740
+ string column_type = 2;
741
+ bool required = 3;
742
+ bool unique = 4;
743
+ string default_value = 5;
744
+ string comment = 6;
745
+ string uuid = 7;
746
+ string table_definition_uuid = 8;
747
+ optional bool custom_foreign_key = 9;
748
+ optional TableMetaDataMigration table_definition = 10;
749
+ int32 id = 11;
750
+ }
751
+ message TableMetaDataMigration {
752
+ string name = 1;
753
+ string uuid = 2;
754
+ }
755
+ message TableIndexMigration {
756
+ string name = 1;
757
+ bool unique = 2;
758
+ string uuid = 3;
759
+ string table_definition_uuid = 4;
760
+ repeated MigrationColumnDefinition column_definitions = 5;
761
+ bool single_index = 6;
762
+ optional TableMetaDataMigration table_definition = 7;
763
+ int32 id = 8;
764
+ }
765
+ message TableRelationMigration {
766
+ string foreign_key = 1;
767
+ string relation_type = 2;
768
+ bool required = 3;
769
+ string uuid = 4;
770
+ string table_definition_uuid = 5;
771
+ string related_table_uuid = 6;
772
+ optional bool custom_foreign_key = 7;
773
+ CreateTableChange table_definition = 8;
774
+ CreateTableChange related_table = 9;
775
+ int32 id = 10;
776
+ }