Task List Service UI
In order to help you build your own Solution, find below an example of a basic YAML model, serving as a "Hello World" for you to understand the power of our source code generator.
This example model reflects a use case for Task List Registration, which is intended to perform certain registration operations (CRUD) to the database.
Also a simple UI project is included in model definition, once deployed this UI can be used to perform all tasks directly in the browser.
YAML Example:
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635 | Name: TaskListUI # Solution name
RootNamespace: TaskListUI # Solution root namespace
# Business entities
Entities:
- Name: Task
KeyType: Guid
Properties:
- Name: Title
Type: string
- Name: Description
Type: string
- Name: DueDate
Type: DateTimeOffset
- Name: TaskType # Relationship with TaskType Entity
Type: TaskType
- Name: TaskTypeId
Type: int
- Name: TaskStatus # Relationship with TaskStatus Entity
Type: TaskStatus
- Name: TaskStatusId
Type: int
- Name: CreatedUtc
Type: DateTimeOffset
- Name: ModifiedUtc
Type: DateTimeOffset
- Name: TaskType
KeyType: int
Properties:
- Name: Name
Type: string
- Name: Tasks
Type: '[Task]'
- Name: TaskStatus
KeyType: int
Properties:
- Name: Name
Type: string
- Name: Tasks
Type: '[Task]'
# Database instance types
DbInstances:
- Name: PostgreInstance
Type: PostgreSql
Databases:
- Name: TasksDb
DbInstanceName: PostgreInstance
# Identity Server configuration section
IdentityConfig:
DatabaseName: TasksDb # The database for Identity Server data storage
# Database data contexts
DbContexts:
- Name: TasksDbContext
DatabaseName: TasksDb
# Data access repository pattern
Repositories:
- Name: TaskRepo
DbContextName: TasksDbContext
EntityName: Task
- Name: TaskTypeRepo
DbContextName: TasksDbContext
EntityName: TaskType
- Name: TaskStatusRepo
DbContextName: TasksDbContext
EntityName: TaskStatus
# Validations rules for the business entity
EntityValidations:
- Name: TaskValidation
Type: PropertyValidation
EntityName: Task
PropertyValidationParams:
- PropertyName: Title
Rules: # Pre-defined types that run sequentially
- Type: IsNotEmpty
Message: Title is required.
- PropertyName: DueDate
Rules:
- Type: IsNotEmpty
Message: Due Date is required.
- PropertyName: TaskTypeId
Rules:
- Type: IsNotEmpty
Message: Type of Task is required.
- PropertyName: TaskStatusId
Rules:
- Type: IsNotEmpty
Message: Status is required.
- Name: TaskTypeValidation
Type: PropertyValidation
EntityName: TaskType
PropertyValidationParams:
- PropertyName: Name
Rules:
- Type: IsNotEmpty
Message: Name is required.
- Name: TaskStatusValidation
Type: PropertyValidation
EntityName: TaskStatus
PropertyValidationParams:
- PropertyName: Name
Rules:
- Type: IsNotEmpty
Message: Name is required.
# Services and Controllers (CRUD + Query)
Services:
- Name: TaskService
Type: WebAPI
Controllers:
- Name: Task
Type: CRUD
EntityName: Task
RepositoryName: TaskRepo
Contexts:
- Context: Create
Validations: # Validations performed only for the "Create" context
- Name: DataMustBeValid
Type: EntityValidation
Order: 1
ExecValidationName: TaskValidation
Rules: # Business rules performed only for the "Create" context
- Name: AddInRepository
Type: WriteOperationRule # Executes a business rule for persisting data in the database
Order: 1
- Context: Update
Validations:
- Name: DataMustBeValid
Type: EntityValidation
Order: 1
ExecValidationName: TaskValidation
Rules:
- Name: UpdateInRepository
Type: WriteOperationRule
Order: 1
- Context: UpdatePartial
Rules:
- Name: UpdateInRepository
Type: WriteOperationRule
Order: 1
- Context: Delete
Rules:
- Name: DeleteInRepository
Type: WriteOperationRule
Order: 1
- Context: ReadAll
Rules:
- Name: ReadInRepository
Type: ReadOperationRule # Executes a business rule for reading data from the database
Order: 1
- Context: ReadByKey
Rules:
- Name: ReadInRepository
Type: ReadOperationRule
Order: 1
- Name: TaskType
Type: CRUD
EntityName: TaskType
RepositoryName: TaskTypeRepo
Contexts:
- Context: Create
Validations:
- Name: DataMustBeValid
Type: EntityValidation
Order: 1
ExecValidationName: TaskTypeValidation
Rules:
- Name: AddInRepository
Type: WriteOperationRule
Order: 1
- Context: Update
Validations:
- Name: DataMustBeValid
Type: EntityValidation
Order: 1
ExecValidationName: TaskTypeValidation
Rules:
- Name: UpdateInRepository
Type: WriteOperationRule
Order: 1
- Context: UpdatePartial
Rules:
- Name: UpdateInRepository
Type: WriteOperationRule
Order: 1
- Context: Delete
Rules:
- Name: DeleteInRepository
Type: WriteOperationRule
Order: 1
- Context: ReadAll
Rules:
- Name: ReadInRepository
Type: ReadOperationRule
Order: 1
- Context: ReadByKey
Rules:
- Name: ReadInRepository
Type: ReadOperationRule
Order: 1
- Name: TaskStatus
Type: CRUD
EntityName: TaskStatus
RepositoryName: TaskStatusRepo
Contexts:
- Context: Create
Validations:
- Name: DataMustBeValid
Type: EntityValidation
Order: 1
ExecValidationName: TaskStatusValidation
Rules:
- Name: AddInRepository
Type: WriteOperationRule
Order: 1
- Context: Update
Validations:
- Name: DataMustBeValid
Type: EntityValidation
Order: 1
ExecValidationName: TaskStatusValidation
Rules:
- Name: UpdateInRepository
Type: WriteOperationRule
Order: 1
- Context: UpdatePartial
Rules:
- Name: UpdateInRepository
Type: WriteOperationRule
Order: 1
- Context: Delete
Rules:
- Name: DeleteInRepository
Type: WriteOperationRule
Order: 1
- Context: ReadAll
Rules:
- Name: ReadInRepository
Type: ReadOperationRule
Order: 1
- Context: ReadByKey
Rules:
- Name: ReadInRepository
Type: ReadOperationRule
Order: 1
# Required Query Controller to perform UI operations such as filter, sorting...
- Name: QueryTask
Type: QUERY
RepositoryName: TaskRepo
EntityName: Task
- Name: QueryTaskType
Type: QUERY
RepositoryName: TaskTypeRepo
EntityName: TaskType
- Name: QueryTaskStatus
Type: QUERY
RepositoryName: TaskStatusRepo
EntityName: TaskStatus
UIs:
- Name: TaskListUI # UI project (used for Angular Project + BFF)
Route: tasklist
Menus:
- Path: tasks
Label: Task
Description: Task Register
UiStructure: task
RouteGroups:
- Type: List
Roles: ['admin','users']
Label: Query tasks
- Type: Edit
Roles: ['admin','users']
Label: Task
- Path: type
Label: TaskType
Description: Task Type Register
UiStructure: taskType
RouteGroups:
- Type: List
Roles: ['admin','users']
Label: Query task types
- Type: Edit
Roles: ['admin','users']
Label: Task type
- Path: status
Label: TaskStatus
Description: Task Status Register
UiStructure: taskStatus
RouteGroups:
- Type: List
Roles: ['admin','users']
Label: Query task status
- Type: Edit
Roles: ['admin','users']
Label: Task status
- Path: kpi1
Label: Task Kpi 1
Description: Task Kpi 1 - Indicator
UiStructure: taskKpi1
RouteGroups:
- Type: Index
Roles: ['admin','users']
Label: Tasks by type and status indicator
- Path: kpi2
Label: Task Kpi 2
Description: Task Kpi 2 - Indicator
UiStructure: taskKpi2
RouteGroups:
- Type: Index
Roles: ['admin','users']
Label: Tasks by status indicator
- Path: kpi3
Label: Task Kpi 3
Description: Task Kpi 3 - Indicator
UiStructure: taskKpi3
RouteGroups:
- Type: Index
Roles: ['admin','users']
Label: Total tasks indicator
- Path: kpi4
Label: Task Kpi 4
Description: Task Kpi 4 - Indicator
UiStructure: taskKpi4
RouteGroups:
- Type: Index
Roles: ['admin','users']
Label: Tasks by type indicator
- Path: kpi5
Label: Task Kpi 5
Description: Task Kpi 5 - Indicator
UiStructure: taskKpi5
RouteGroups:
- Type: Index
Roles: ['admin','users']
Label: Tasks by status indicator
- Path: dash
Label: Tasks Dashboard
Description: Tasks Main Dashboard
UiStructure: mainDashboard
RouteGroups:
- Type: Index
Roles: ['admin','users']
Label: Tasks Main Dashboard
UIStructures:
# CRUD Structures
- Name: task # Set of components to perform Task Crud
Entity: Task
Type: Crud
Service: Task
CrudParams:
Controls:
- Property: Title
Label: Title
Hint: 'Inform task title'
Type: text
Placeholder: Task title
- Property: Description
Label: Desc.
Hint: 'Inform task description'
Type: multiline
- Property: DueDate
Label: Due Date
Hint: 'Inform task due date'
Type: date
- Property: 'TaskTypeId'
Label: 'Type of Task'
Type: combo
Source: TaskType
ValueField: Id
LabelFields: ['Name']
- Property: 'TaskStatusId'
Label: 'Status'
Type: combo
Source: TaskStatus
ValueField: Id
LabelFields: ['Name']
Filter:
FormControls: ['Title']
SubmitButtonLabel: Search
SubmitButtonStyle: basic
Grid:
QueryOrderFields:
- Property: Title
Type: asc
QueryRegistersLimit: 100
PageSizes: [5, 10 , 20]
Fields:
- Property: Title
- Property: TaskType.Name
Title: Type
- Property: TaskStatus.Name
Title: Status
EditForm:
FormControls: ['Title', 'Description', 'DueDate', 'TaskStatusId', 'TaskTypeId']
Validations: ['TaskValidation']
SubmitButtonLabel: 'Save'
SubmitButtonStyle: primary
- Name: taskType # Set of components to perform TaskType Crud
Entity: TaskType
Type: Crud
Service: TaskType
CrudParams:
Controls:
- Property: Name
Label: Name
Hint: 'Inform task type'
Type: text
Filter:
FormControls: ['Name']
SubmitButtonLabel: Search
SubmitButtonStyle: basic
Grid:
QueryOrderFields:
- Property: Name
Type: asc
QueryRegistersLimit: 100
PageSizes: [5, 10 , 20]
Fields:
- Property: Name
EditForm:
FormControls: ['Name']
Validations: ['TaskTypeValidation']
SubmitButtonLabel: 'Save'
SubmitButtonStyle: primary
- Name: taskStatus # Set of components to perform TaskStatus Crud
Entity: TaskStatus
Type: Crud
Service: TaskStatus
CrudParams:
Controls:
- Property: Name
Label: Name
Hint: 'Inform task status'
Type: text
Filter:
FormControls: ['Name']
SubmitButtonLabel: Search
SubmitButtonStyle: basic
Grid:
QueryOrderFields:
- Property: Name
Type: asc
QueryRegistersLimit: 100
PageSizes: [5, 10 , 20]
Fields:
- Property: Name
EditForm:
FormControls: ['Name']
Validations: ['TaskStatusValidation']
SubmitButtonLabel: 'Save'
SubmitButtonStyle: primary
# CHART Structures
- Name: taskKpi1
Entity: Task
Type: Chart
Service: Task
ChartParams:
Title: Task Kpi 1
Description: Tasks by type and status
AxisAggregatePropertyName: TaskTypeId
AxisAggregatePropertyLabel: TaskType.Name
Series:
- PropertyName: Id
Operator: Count
Label: Total
Type: bar
AggregatePropertyName: TaskStatusId
AggregatePropertyLabel: TaskStatus.Name
- Name: taskKpi2
Entity: Task
Type: Chart
Service: Task
ChartParams:
Title: Task Kpi 2
Description: Tasks by status
Series:
- PropertyName: Id
Operator: Count
Label: Total
Type: donut
AggregatePropertyName: TaskStatusId
AggregatePropertyLabel: TaskStatus.Name
- Name: taskKpi3
Entity: Task
Type: Chart
Service: Task
ChartParams:
Title: Task Kpi 3
Description: Tasks Total
Series:
- PropertyName: Id
Operator: Count
Label: Total
Type: radialBar
- Name: taskKpi4
Entity: Task
Type: Chart
Service: Task
ChartParams:
Title: Task Kpi 4
Description: Tasks By Type Total
AxisAggregatePropertyName: TaskTypeId
AxisAggregatePropertyLabel: TaskType.Name
RenderAsSpark: true
Series:
- PropertyName: Id
Operator: Count
Label: Total
Type: area
- Name: taskKpi5
Entity: Task
Type: Chart
Service: Task
ChartParams:
Title: Task Kpi 5
Description: Tasks By Status Total
AxisAggregatePropertyName: TaskStatusId
AxisAggregatePropertyLabel: TaskStatus.Name
Series:
- PropertyName: Id
Operator: Count
Label: Total
Type: line
- Name: taskKpi6
Entity: Task
Type: Chart
Service: Task
ChartParams:
Title: Task Kpi 6
Description: Tasks By Status Total
AxisAggregatePropertyName: TaskStatusId
AxisAggregatePropertyLabel: TaskStatus.Name
RenderAsSpark: true
Series:
- PropertyName: Id
Operator: Count
Label: Total
Type: area
# DASHBOARD Structures
- Name: mainDashboard
Entity: Task
Type: Dashboard
Service: Task
DashboardParams:
Title: Tasks Main Dashboard
Kpis: [taskKpi1, taskKpi2, taskKpi3, taskKpi4, taskKpi5, taskKpi6]
UIServices:
- Name: Task # Service which will be used to perform UI operations
Entity: Task
CrudService: TaskService
CrudController: Task
QueryService: TaskService
QueryController: QueryTask
- Name: TaskType
Entity: TaskType
CrudService: TaskService
CrudController: TaskType
QueryService: TaskService
QueryController: QueryTaskType
- Name: TaskStatus
Entity: TaskStatus
CrudService: TaskService
CrudController: TaskStatus
QueryService: TaskService
QueryController: QueryTaskStatus
|
OData Example
| ...
- Name: QueryTask
Type: QUERY
RepositoryName: TaskRepo
EntityName: Task
...
|
Filter Request Example
| https://loadbalancer.bea.internal:44300/taskservice/odata/QueryTaskQuery?$filter=Title eq 'Task 02'
|
Response Example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 | {
"@odata.context": "https://loadbalancer.bea.internal:44300/taskservice/odata/$metadata#QueryTaskQuery",
"value": [
{
"Id": "20048b5b-ff49-4039-b82a-fd6281d83bfb",
"Title": "Task 02",
"Description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
"DueDate": "2020-12-31T00:00:00Z",
"Status": 1
},
{
"Id": "f5448d16-4e75-4d3c-9f4b-00cfbd654815",
"Title": "Task 02",
"Description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
"DueDate": "2020-12-31T00:00:00Z",
"Status": 1
}
]
}
|
Order By Request Example
| https://loadbalancer.bea.internal:44300/taskservice/odata/QueryTaskQuery?$orderby=Title desc
|
Response Example
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 | {
"@odata.context": "https://loadbalancer.bea.internal:44300/taskservice/odata/$metadata#QueryTaskQuery",
"value": [
{
"Id": "3a9f0563-d4ca-4931-881e-194d6e6b2f0e",
"Title": "Task 03",
"Description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
"DueDate": "2020-12-31T00:00:00Z",
"Status": 1
},
{
"Id": "20048b5b-ff49-4039-b82a-fd6281d83bfb",
"Title": "Task 02",
"Description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
"DueDate": "2020-12-31T00:00:00Z",
"Status": 1
},
{
"Id": "f5448d16-4e75-4d3c-9f4b-00cfbd654815",
"Title": "Task 02",
"Description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
"DueDate": "2020-12-31T00:00:00Z",
"Status": 1
},
{
"Id": "33dd9a85-5382-4b77-a451-cc44474f5bf1",
"Title": "Task 01",
"Description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
"DueDate": "2020-12-31T00:00:00Z",
"Status": 1
}
]
}
|