@loopback/sequelize 0.1.0

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.
Files changed (87) hide show
  1. package/LICENSE +25 -0
  2. package/README.md +194 -0
  3. package/dist/.sandbox/6646miobBk/application.js +15 -0
  4. package/dist/.sandbox/6646miobBk/controllers/book-category.controller.js +41 -0
  5. package/dist/.sandbox/6646miobBk/controllers/book.controller.js +210 -0
  6. package/dist/.sandbox/6646miobBk/controllers/category.controller.js +198 -0
  7. package/dist/.sandbox/6646miobBk/controllers/developer.controller.js +177 -0
  8. package/dist/.sandbox/6646miobBk/controllers/doctor-patient.controller.js +112 -0
  9. package/dist/.sandbox/6646miobBk/controllers/doctor.controller.js +177 -0
  10. package/dist/.sandbox/6646miobBk/controllers/index.js +20 -0
  11. package/dist/.sandbox/6646miobBk/controllers/patient.controller.js +165 -0
  12. package/dist/.sandbox/6646miobBk/controllers/programming-languange.controller.js +204 -0
  13. package/dist/.sandbox/6646miobBk/controllers/test.controller.base.js +25 -0
  14. package/dist/.sandbox/6646miobBk/controllers/todo-list-todo.controller.js +113 -0
  15. package/dist/.sandbox/6646miobBk/controllers/todo-list.controller.js +177 -0
  16. package/dist/.sandbox/6646miobBk/controllers/todo-todo-list.controller.js +41 -0
  17. package/dist/.sandbox/6646miobBk/controllers/todo.controller.js +177 -0
  18. package/dist/.sandbox/6646miobBk/controllers/user-todo-list.controller.js +113 -0
  19. package/dist/.sandbox/6646miobBk/controllers/user.controller.js +210 -0
  20. package/dist/.sandbox/6646miobBk/datasources/db.datasource.js +28 -0
  21. package/dist/.sandbox/6646miobBk/models/appointment.model.js +37 -0
  22. package/dist/.sandbox/6646miobBk/models/book.model.js +48 -0
  23. package/dist/.sandbox/6646miobBk/models/category.model.js +32 -0
  24. package/dist/.sandbox/6646miobBk/models/developer.model.js +40 -0
  25. package/dist/.sandbox/6646miobBk/models/doctor.model.js +44 -0
  26. package/dist/.sandbox/6646miobBk/models/index.js +15 -0
  27. package/dist/.sandbox/6646miobBk/models/patient.model.js +32 -0
  28. package/dist/.sandbox/6646miobBk/models/programming-language.model.js +32 -0
  29. package/dist/.sandbox/6646miobBk/models/todo-list.model.js +45 -0
  30. package/dist/.sandbox/6646miobBk/models/todo.model.js +44 -0
  31. package/dist/.sandbox/6646miobBk/models/user.model.js +85 -0
  32. package/dist/.sandbox/6646miobBk/repositories/appointment.repository.js +20 -0
  33. package/dist/.sandbox/6646miobBk/repositories/book.repository.js +25 -0
  34. package/dist/.sandbox/6646miobBk/repositories/category.repository.js +20 -0
  35. package/dist/.sandbox/6646miobBk/repositories/developer.repository.js +25 -0
  36. package/dist/.sandbox/6646miobBk/repositories/doctor.repository.js +27 -0
  37. package/dist/.sandbox/6646miobBk/repositories/index.js +15 -0
  38. package/dist/.sandbox/6646miobBk/repositories/patient.repository.js +20 -0
  39. package/dist/.sandbox/6646miobBk/repositories/programming-language.repository.js +20 -0
  40. package/dist/.sandbox/6646miobBk/repositories/todo-list.repository.js +25 -0
  41. package/dist/.sandbox/6646miobBk/repositories/todo.repository.js +25 -0
  42. package/dist/.sandbox/6646miobBk/repositories/user.repository.js +29 -0
  43. package/dist/component.d.ts +7 -0
  44. package/dist/component.js +30 -0
  45. package/dist/component.js.map +1 -0
  46. package/dist/index.d.ts +4 -0
  47. package/dist/index.js +12 -0
  48. package/dist/index.js.map +1 -0
  49. package/dist/keys.d.ts +8 -0
  50. package/dist/keys.js +16 -0
  51. package/dist/keys.js.map +1 -0
  52. package/dist/sequelize/connector-mapping.d.ts +9 -0
  53. package/dist/sequelize/connector-mapping.js +19 -0
  54. package/dist/sequelize/connector-mapping.js.map +1 -0
  55. package/dist/sequelize/index.d.ts +2 -0
  56. package/dist/sequelize/index.js +10 -0
  57. package/dist/sequelize/index.js.map +1 -0
  58. package/dist/sequelize/operator-translation.d.ts +8 -0
  59. package/dist/sequelize/operator-translation.js +31 -0
  60. package/dist/sequelize/operator-translation.js.map +1 -0
  61. package/dist/sequelize/sequelize.datasource.base.d.ts +23 -0
  62. package/dist/sequelize/sequelize.datasource.base.js +60 -0
  63. package/dist/sequelize/sequelize.datasource.base.js.map +1 -0
  64. package/dist/sequelize/sequelize.model.d.ts +7 -0
  65. package/dist/sequelize/sequelize.model.js +24 -0
  66. package/dist/sequelize/sequelize.model.js.map +1 -0
  67. package/dist/sequelize/sequelize.repository.base.d.ts +231 -0
  68. package/dist/sequelize/sequelize.repository.base.js +835 -0
  69. package/dist/sequelize/sequelize.repository.base.js.map +1 -0
  70. package/dist/sequelize/utils.d.ts +6 -0
  71. package/dist/sequelize/utils.js +17 -0
  72. package/dist/sequelize/utils.js.map +1 -0
  73. package/dist/types.d.ts +9 -0
  74. package/dist/types.js +14 -0
  75. package/dist/types.js.map +1 -0
  76. package/package.json +64 -0
  77. package/src/component.ts +34 -0
  78. package/src/index.ts +9 -0
  79. package/src/keys.ts +16 -0
  80. package/src/sequelize/connector-mapping.ts +26 -0
  81. package/src/sequelize/index.ts +7 -0
  82. package/src/sequelize/operator-translation.ts +32 -0
  83. package/src/sequelize/sequelize.datasource.base.ts +81 -0
  84. package/src/sequelize/sequelize.model.ts +22 -0
  85. package/src/sequelize/sequelize.repository.base.ts +1246 -0
  86. package/src/sequelize/utils.ts +13 -0
  87. package/src/types.ts +19 -0
@@ -0,0 +1,204 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ProgrammingLanguangeController = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const repository_1 = require("@loopback/repository");
6
+ const rest_1 = require("@loopback/rest");
7
+ const models_1 = require("../models");
8
+ const repositories_1 = require("../repositories");
9
+ let ProgrammingLanguangeController = class ProgrammingLanguangeController {
10
+ constructor(programmingLanguageRepository) {
11
+ this.programmingLanguageRepository = programmingLanguageRepository;
12
+ }
13
+ async create(programmingLanguage) {
14
+ return this.programmingLanguageRepository.create(programmingLanguage);
15
+ }
16
+ async createAll(programmingLanguages) {
17
+ return this.programmingLanguageRepository.createAll(programmingLanguages);
18
+ }
19
+ async count(where) {
20
+ return this.programmingLanguageRepository.count(where);
21
+ }
22
+ async find(filter) {
23
+ return this.programmingLanguageRepository.find(filter);
24
+ }
25
+ async updateAll(programmingLanguage, where) {
26
+ return this.programmingLanguageRepository.updateAll(programmingLanguage, where);
27
+ }
28
+ async findById(id, filter) {
29
+ return this.programmingLanguageRepository.findById(id, filter);
30
+ }
31
+ async updateById(id, programmingLanguage) {
32
+ await this.programmingLanguageRepository.updateById(id, programmingLanguage);
33
+ }
34
+ async replaceById(id, programmingLanguage) {
35
+ await this.programmingLanguageRepository.replaceById(id, programmingLanguage);
36
+ }
37
+ async deleteById(id) {
38
+ await this.programmingLanguageRepository.deleteById(id);
39
+ }
40
+ };
41
+ tslib_1.__decorate([
42
+ (0, rest_1.post)('/programming-languages'),
43
+ (0, rest_1.response)(200, {
44
+ description: 'ProgrammingLanguage model instance',
45
+ content: {
46
+ 'application/json': { schema: (0, rest_1.getModelSchemaRef)(models_1.ProgrammingLanguage) },
47
+ },
48
+ }),
49
+ tslib_1.__param(0, (0, rest_1.requestBody)({
50
+ content: {
51
+ 'application/json': {
52
+ schema: (0, rest_1.getModelSchemaRef)(models_1.ProgrammingLanguage, {
53
+ title: 'NewProgrammingLanguage',
54
+ exclude: ['id'],
55
+ }),
56
+ },
57
+ },
58
+ })),
59
+ tslib_1.__metadata("design:type", Function),
60
+ tslib_1.__metadata("design:paramtypes", [Object]),
61
+ tslib_1.__metadata("design:returntype", Promise)
62
+ ], ProgrammingLanguangeController.prototype, "create", null);
63
+ tslib_1.__decorate([
64
+ (0, rest_1.post)('/programming-languages-bulk'),
65
+ (0, rest_1.response)(200, {
66
+ description: 'ProgrammingLanguage model instances',
67
+ content: {
68
+ 'application/json': {
69
+ schema: {
70
+ type: 'array',
71
+ items: (0, rest_1.getModelSchemaRef)(models_1.ProgrammingLanguage),
72
+ },
73
+ },
74
+ },
75
+ }),
76
+ tslib_1.__param(0, (0, rest_1.requestBody)({
77
+ content: {
78
+ 'application/json': {
79
+ schema: {
80
+ type: 'array',
81
+ items: (0, rest_1.getModelSchemaRef)(models_1.ProgrammingLanguage, {
82
+ title: 'NewProgrammingLanguage',
83
+ exclude: ['id'],
84
+ }),
85
+ },
86
+ },
87
+ },
88
+ })),
89
+ tslib_1.__metadata("design:type", Function),
90
+ tslib_1.__metadata("design:paramtypes", [Array]),
91
+ tslib_1.__metadata("design:returntype", Promise)
92
+ ], ProgrammingLanguangeController.prototype, "createAll", null);
93
+ tslib_1.__decorate([
94
+ (0, rest_1.get)('/programming-languages/count'),
95
+ (0, rest_1.response)(200, {
96
+ description: 'ProgrammingLanguage model count',
97
+ content: { 'application/json': { schema: repository_1.CountSchema } },
98
+ }),
99
+ tslib_1.__param(0, rest_1.param.where(models_1.ProgrammingLanguage)),
100
+ tslib_1.__metadata("design:type", Function),
101
+ tslib_1.__metadata("design:paramtypes", [Object]),
102
+ tslib_1.__metadata("design:returntype", Promise)
103
+ ], ProgrammingLanguangeController.prototype, "count", null);
104
+ tslib_1.__decorate([
105
+ (0, rest_1.get)('/programming-languages'),
106
+ (0, rest_1.response)(200, {
107
+ description: 'Array of ProgrammingLanguage model instances',
108
+ content: {
109
+ 'application/json': {
110
+ schema: {
111
+ type: 'array',
112
+ items: (0, rest_1.getModelSchemaRef)(models_1.ProgrammingLanguage, {
113
+ includeRelations: true,
114
+ }),
115
+ },
116
+ },
117
+ },
118
+ }),
119
+ tslib_1.__param(0, rest_1.param.filter(models_1.ProgrammingLanguage)),
120
+ tslib_1.__metadata("design:type", Function),
121
+ tslib_1.__metadata("design:paramtypes", [Object]),
122
+ tslib_1.__metadata("design:returntype", Promise)
123
+ ], ProgrammingLanguangeController.prototype, "find", null);
124
+ tslib_1.__decorate([
125
+ (0, rest_1.patch)('/programming-languages'),
126
+ (0, rest_1.response)(200, {
127
+ description: 'ProgrammingLanguage PATCH success count',
128
+ content: { 'application/json': { schema: repository_1.CountSchema } },
129
+ }),
130
+ tslib_1.__param(0, (0, rest_1.requestBody)({
131
+ content: {
132
+ 'application/json': {
133
+ schema: (0, rest_1.getModelSchemaRef)(models_1.ProgrammingLanguage, { partial: true }),
134
+ },
135
+ },
136
+ })),
137
+ tslib_1.__param(1, rest_1.param.where(models_1.ProgrammingLanguage)),
138
+ tslib_1.__metadata("design:type", Function),
139
+ tslib_1.__metadata("design:paramtypes", [models_1.ProgrammingLanguage, Object]),
140
+ tslib_1.__metadata("design:returntype", Promise)
141
+ ], ProgrammingLanguangeController.prototype, "updateAll", null);
142
+ tslib_1.__decorate([
143
+ (0, rest_1.get)('/programming-languages/{id}'),
144
+ (0, rest_1.response)(200, {
145
+ description: 'ProgrammingLanguage model instance',
146
+ content: {
147
+ 'application/json': {
148
+ schema: (0, rest_1.getModelSchemaRef)(models_1.ProgrammingLanguage, {
149
+ includeRelations: true,
150
+ }),
151
+ },
152
+ },
153
+ }),
154
+ tslib_1.__param(0, rest_1.param.path.number('id')),
155
+ tslib_1.__param(1, rest_1.param.filter(models_1.ProgrammingLanguage, { exclude: 'where' })),
156
+ tslib_1.__metadata("design:type", Function),
157
+ tslib_1.__metadata("design:paramtypes", [Number, Object]),
158
+ tslib_1.__metadata("design:returntype", Promise)
159
+ ], ProgrammingLanguangeController.prototype, "findById", null);
160
+ tslib_1.__decorate([
161
+ (0, rest_1.patch)('/programming-languages/{id}'),
162
+ (0, rest_1.response)(204, {
163
+ description: 'ProgrammingLanguage PATCH success',
164
+ }),
165
+ tslib_1.__param(0, rest_1.param.path.number('id')),
166
+ tslib_1.__param(1, (0, rest_1.requestBody)({
167
+ content: {
168
+ 'application/json': {
169
+ schema: (0, rest_1.getModelSchemaRef)(models_1.ProgrammingLanguage, { partial: true }),
170
+ },
171
+ },
172
+ })),
173
+ tslib_1.__metadata("design:type", Function),
174
+ tslib_1.__metadata("design:paramtypes", [Number, models_1.ProgrammingLanguage]),
175
+ tslib_1.__metadata("design:returntype", Promise)
176
+ ], ProgrammingLanguangeController.prototype, "updateById", null);
177
+ tslib_1.__decorate([
178
+ (0, rest_1.put)('/programming-languages/{id}'),
179
+ (0, rest_1.response)(204, {
180
+ description: 'ProgrammingLanguage PUT success',
181
+ }),
182
+ tslib_1.__param(0, rest_1.param.path.number('id')),
183
+ tslib_1.__param(1, (0, rest_1.requestBody)()),
184
+ tslib_1.__metadata("design:type", Function),
185
+ tslib_1.__metadata("design:paramtypes", [Number, models_1.ProgrammingLanguage]),
186
+ tslib_1.__metadata("design:returntype", Promise)
187
+ ], ProgrammingLanguangeController.prototype, "replaceById", null);
188
+ tslib_1.__decorate([
189
+ (0, rest_1.del)('/programming-languages/{id}'),
190
+ (0, rest_1.response)(204, {
191
+ description: 'ProgrammingLanguage DELETE success',
192
+ }),
193
+ tslib_1.__param(0, rest_1.param.path.number('id')),
194
+ tslib_1.__metadata("design:type", Function),
195
+ tslib_1.__metadata("design:paramtypes", [Number]),
196
+ tslib_1.__metadata("design:returntype", Promise)
197
+ ], ProgrammingLanguangeController.prototype, "deleteById", null);
198
+ ProgrammingLanguangeController = tslib_1.__decorate([
199
+ tslib_1.__param(0, (0, repository_1.repository)(repositories_1.ProgrammingLanguageRepository)),
200
+ tslib_1.__metadata("design:paramtypes", [repositories_1.ProgrammingLanguageRepository])
201
+ ], ProgrammingLanguangeController);
202
+ exports.ProgrammingLanguangeController = ProgrammingLanguangeController;
203
+ //# sourceMappingURL=programming-languange.controller.js.map
204
+ //# sourceMappingURL=/Users/dianalau/code/loopback/loopback-next/extensions/sequelize/dist/__tests__/fixtures/controllers/programming-languange.controller.js.map
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TestControllerBase = void 0;
4
+ class TestControllerBase {
5
+ constructor(repository) {
6
+ this.repository = repository;
7
+ }
8
+ /**
9
+ * `beforeEach` is only for testing purposes in the controller,
10
+ * Calling `syncSequelizeModel` ensures that corresponding table
11
+ * exists before calling the function. In real project you are supposed
12
+ * to run migrations instead, to sync model definitions to the target database.
13
+ */
14
+ async beforeEach(options = {}) {
15
+ const syncOptions = { force: false };
16
+ if (options.syncAll) {
17
+ await this.repository.syncLoadedSequelizeModels(syncOptions);
18
+ return;
19
+ }
20
+ await this.repository.syncSequelizeModel(syncOptions);
21
+ }
22
+ }
23
+ exports.TestControllerBase = TestControllerBase;
24
+ //# sourceMappingURL=test.controller.base.js.map
25
+ //# sourceMappingURL=/Users/dianalau/code/loopback/loopback-next/extensions/sequelize/dist/__tests__/fixtures/controllers/test.controller.base.js.map
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TodoListTodoController = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const repository_1 = require("@loopback/repository");
6
+ const rest_1 = require("@loopback/rest");
7
+ const models_1 = require("../models");
8
+ const repositories_1 = require("../repositories");
9
+ let TodoListTodoController = class TodoListTodoController {
10
+ constructor(todoListRepository) {
11
+ this.todoListRepository = todoListRepository;
12
+ }
13
+ async find(id, filter) {
14
+ return this.todoListRepository.todos(id).find(filter);
15
+ }
16
+ async create(id, todo) {
17
+ return this.todoListRepository.todos(id).create(todo);
18
+ }
19
+ async patch(id, todo, where) {
20
+ return this.todoListRepository.todos(id).patch(todo, where);
21
+ }
22
+ async delete(id, where) {
23
+ return this.todoListRepository.todos(id).delete(where);
24
+ }
25
+ };
26
+ tslib_1.__decorate([
27
+ (0, rest_1.get)('/todo-lists/{id}/todos', {
28
+ responses: {
29
+ '200': {
30
+ description: 'Array of TodoList has many Todo',
31
+ content: {
32
+ 'application/json': {
33
+ schema: { type: 'array', items: (0, rest_1.getModelSchemaRef)(models_1.Todo) },
34
+ },
35
+ },
36
+ },
37
+ },
38
+ }),
39
+ tslib_1.__param(0, rest_1.param.path.number('id')),
40
+ tslib_1.__param(1, rest_1.param.query.object('filter')),
41
+ tslib_1.__metadata("design:type", Function),
42
+ tslib_1.__metadata("design:paramtypes", [Number, Object]),
43
+ tslib_1.__metadata("design:returntype", Promise)
44
+ ], TodoListTodoController.prototype, "find", null);
45
+ tslib_1.__decorate([
46
+ (0, rest_1.post)('/todo-lists/{id}/todos', {
47
+ responses: {
48
+ '200': {
49
+ description: 'TodoList model instance',
50
+ content: { 'application/json': { schema: (0, rest_1.getModelSchemaRef)(models_1.Todo) } },
51
+ },
52
+ },
53
+ }),
54
+ tslib_1.__param(0, rest_1.param.path.number('id')),
55
+ tslib_1.__param(1, (0, rest_1.requestBody)({
56
+ content: {
57
+ 'application/json': {
58
+ schema: (0, rest_1.getModelSchemaRef)(models_1.Todo, {
59
+ title: 'NewTodoInTodoList',
60
+ exclude: ['id'],
61
+ optional: ['todoListId'],
62
+ }),
63
+ },
64
+ },
65
+ })),
66
+ tslib_1.__metadata("design:type", Function),
67
+ tslib_1.__metadata("design:paramtypes", [Object, Object]),
68
+ tslib_1.__metadata("design:returntype", Promise)
69
+ ], TodoListTodoController.prototype, "create", null);
70
+ tslib_1.__decorate([
71
+ (0, rest_1.patch)('/todo-lists/{id}/todos', {
72
+ responses: {
73
+ '200': {
74
+ description: 'TodoList.Todo PATCH success count',
75
+ content: { 'application/json': { schema: repository_1.CountSchema } },
76
+ },
77
+ },
78
+ }),
79
+ tslib_1.__param(0, rest_1.param.path.number('id')),
80
+ tslib_1.__param(1, (0, rest_1.requestBody)({
81
+ content: {
82
+ 'application/json': {
83
+ schema: (0, rest_1.getModelSchemaRef)(models_1.Todo, { partial: true }),
84
+ },
85
+ },
86
+ })),
87
+ tslib_1.__param(2, rest_1.param.query.object('where', (0, rest_1.getWhereSchemaFor)(models_1.Todo))),
88
+ tslib_1.__metadata("design:type", Function),
89
+ tslib_1.__metadata("design:paramtypes", [Number, Object, Object]),
90
+ tslib_1.__metadata("design:returntype", Promise)
91
+ ], TodoListTodoController.prototype, "patch", null);
92
+ tslib_1.__decorate([
93
+ (0, rest_1.del)('/todo-lists/{id}/todos', {
94
+ responses: {
95
+ '200': {
96
+ description: 'TodoList.Todo DELETE success count',
97
+ content: { 'application/json': { schema: repository_1.CountSchema } },
98
+ },
99
+ },
100
+ }),
101
+ tslib_1.__param(0, rest_1.param.path.number('id')),
102
+ tslib_1.__param(1, rest_1.param.query.object('where', (0, rest_1.getWhereSchemaFor)(models_1.Todo))),
103
+ tslib_1.__metadata("design:type", Function),
104
+ tslib_1.__metadata("design:paramtypes", [Number, Object]),
105
+ tslib_1.__metadata("design:returntype", Promise)
106
+ ], TodoListTodoController.prototype, "delete", null);
107
+ TodoListTodoController = tslib_1.__decorate([
108
+ tslib_1.__param(0, (0, repository_1.repository)(repositories_1.TodoListRepository)),
109
+ tslib_1.__metadata("design:paramtypes", [repositories_1.TodoListRepository])
110
+ ], TodoListTodoController);
111
+ exports.TodoListTodoController = TodoListTodoController;
112
+ //# sourceMappingURL=todo-list-todo.controller.js.map
113
+ //# sourceMappingURL=/Users/dianalau/code/loopback/loopback-next/extensions/sequelize/dist/__tests__/fixtures/controllers/todo-list-todo.controller.js.map
@@ -0,0 +1,177 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TodoListController = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const repository_1 = require("@loopback/repository");
6
+ const rest_1 = require("@loopback/rest");
7
+ const models_1 = require("../models");
8
+ const repositories_1 = require("../repositories");
9
+ const test_controller_base_1 = require("./test.controller.base");
10
+ let TodoListController = class TodoListController extends test_controller_base_1.TestControllerBase {
11
+ constructor(todoListRepository) {
12
+ super(todoListRepository);
13
+ this.todoListRepository = todoListRepository;
14
+ }
15
+ async create(todoList) {
16
+ return this.todoListRepository.create(todoList);
17
+ }
18
+ async count(where) {
19
+ return this.todoListRepository.count(where);
20
+ }
21
+ async find(filter) {
22
+ return this.todoListRepository.find(filter);
23
+ }
24
+ async updateAll(todoList, where) {
25
+ return this.todoListRepository.updateAll(todoList, where);
26
+ }
27
+ async findById(id, filter) {
28
+ return this.todoListRepository.findById(id, filter);
29
+ }
30
+ async updateById(id, todoList) {
31
+ await this.todoListRepository.updateById(id, todoList);
32
+ }
33
+ async replaceById(id, todoList) {
34
+ await this.todoListRepository.replaceById(id, todoList);
35
+ }
36
+ async deleteById(id) {
37
+ await this.todoListRepository.deleteById(id);
38
+ }
39
+ async syncSequelizeModel() {
40
+ await this.beforeEach();
41
+ }
42
+ };
43
+ tslib_1.__decorate([
44
+ (0, rest_1.post)('/todo-lists'),
45
+ (0, rest_1.response)(200, {
46
+ description: 'TodoList model instance',
47
+ content: { 'application/json': { schema: (0, rest_1.getModelSchemaRef)(models_1.TodoList) } },
48
+ }),
49
+ tslib_1.__param(0, (0, rest_1.requestBody)({
50
+ content: {
51
+ 'application/json': {
52
+ schema: (0, rest_1.getModelSchemaRef)(models_1.TodoList, {
53
+ title: 'NewTodoList',
54
+ exclude: ['id'],
55
+ }),
56
+ },
57
+ },
58
+ })),
59
+ tslib_1.__metadata("design:type", Function),
60
+ tslib_1.__metadata("design:paramtypes", [Object]),
61
+ tslib_1.__metadata("design:returntype", Promise)
62
+ ], TodoListController.prototype, "create", null);
63
+ tslib_1.__decorate([
64
+ (0, rest_1.get)('/todo-lists/count'),
65
+ (0, rest_1.response)(200, {
66
+ description: 'TodoList model count',
67
+ content: { 'application/json': { schema: repository_1.CountSchema } },
68
+ }),
69
+ tslib_1.__param(0, rest_1.param.where(models_1.TodoList)),
70
+ tslib_1.__metadata("design:type", Function),
71
+ tslib_1.__metadata("design:paramtypes", [Object]),
72
+ tslib_1.__metadata("design:returntype", Promise)
73
+ ], TodoListController.prototype, "count", null);
74
+ tslib_1.__decorate([
75
+ (0, rest_1.get)('/todo-lists'),
76
+ (0, rest_1.response)(200, {
77
+ description: 'Array of TodoList model instances',
78
+ content: {
79
+ 'application/json': {
80
+ schema: {
81
+ type: 'array',
82
+ items: (0, rest_1.getModelSchemaRef)(models_1.TodoList, { includeRelations: true }),
83
+ },
84
+ },
85
+ },
86
+ }),
87
+ tslib_1.__param(0, rest_1.param.filter(models_1.TodoList)),
88
+ tslib_1.__metadata("design:type", Function),
89
+ tslib_1.__metadata("design:paramtypes", [Object]),
90
+ tslib_1.__metadata("design:returntype", Promise)
91
+ ], TodoListController.prototype, "find", null);
92
+ tslib_1.__decorate([
93
+ (0, rest_1.patch)('/todo-lists'),
94
+ (0, rest_1.response)(200, {
95
+ description: 'TodoList PATCH success count',
96
+ content: { 'application/json': { schema: repository_1.CountSchema } },
97
+ }),
98
+ tslib_1.__param(0, (0, rest_1.requestBody)({
99
+ content: {
100
+ 'application/json': {
101
+ schema: (0, rest_1.getModelSchemaRef)(models_1.TodoList, { partial: true }),
102
+ },
103
+ },
104
+ })),
105
+ tslib_1.__param(1, rest_1.param.where(models_1.TodoList)),
106
+ tslib_1.__metadata("design:type", Function),
107
+ tslib_1.__metadata("design:paramtypes", [models_1.TodoList, Object]),
108
+ tslib_1.__metadata("design:returntype", Promise)
109
+ ], TodoListController.prototype, "updateAll", null);
110
+ tslib_1.__decorate([
111
+ (0, rest_1.get)('/todo-lists/{id}'),
112
+ (0, rest_1.response)(200, {
113
+ description: 'TodoList model instance',
114
+ content: {
115
+ 'application/json': {
116
+ schema: (0, rest_1.getModelSchemaRef)(models_1.TodoList, { includeRelations: true }),
117
+ },
118
+ },
119
+ }),
120
+ tslib_1.__param(0, rest_1.param.path.number('id')),
121
+ tslib_1.__param(1, rest_1.param.filter(models_1.TodoList, { exclude: 'where' })),
122
+ tslib_1.__metadata("design:type", Function),
123
+ tslib_1.__metadata("design:paramtypes", [Number, Object]),
124
+ tslib_1.__metadata("design:returntype", Promise)
125
+ ], TodoListController.prototype, "findById", null);
126
+ tslib_1.__decorate([
127
+ (0, rest_1.patch)('/todo-lists/{id}'),
128
+ (0, rest_1.response)(204, {
129
+ description: 'TodoList PATCH success',
130
+ }),
131
+ tslib_1.__param(0, rest_1.param.path.number('id')),
132
+ tslib_1.__param(1, (0, rest_1.requestBody)({
133
+ content: {
134
+ 'application/json': {
135
+ schema: (0, rest_1.getModelSchemaRef)(models_1.TodoList, { partial: true }),
136
+ },
137
+ },
138
+ })),
139
+ tslib_1.__metadata("design:type", Function),
140
+ tslib_1.__metadata("design:paramtypes", [Number, models_1.TodoList]),
141
+ tslib_1.__metadata("design:returntype", Promise)
142
+ ], TodoListController.prototype, "updateById", null);
143
+ tslib_1.__decorate([
144
+ (0, rest_1.put)('/todo-lists/{id}'),
145
+ (0, rest_1.response)(204, {
146
+ description: 'TodoList PUT success',
147
+ }),
148
+ tslib_1.__param(0, rest_1.param.path.number('id')),
149
+ tslib_1.__param(1, (0, rest_1.requestBody)()),
150
+ tslib_1.__metadata("design:type", Function),
151
+ tslib_1.__metadata("design:paramtypes", [Number, models_1.TodoList]),
152
+ tslib_1.__metadata("design:returntype", Promise)
153
+ ], TodoListController.prototype, "replaceById", null);
154
+ tslib_1.__decorate([
155
+ (0, rest_1.del)('/todo-lists/{id}'),
156
+ (0, rest_1.response)(204, {
157
+ description: 'TodoList DELETE success',
158
+ }),
159
+ tslib_1.__param(0, rest_1.param.path.number('id')),
160
+ tslib_1.__metadata("design:type", Function),
161
+ tslib_1.__metadata("design:paramtypes", [Number]),
162
+ tslib_1.__metadata("design:returntype", Promise)
163
+ ], TodoListController.prototype, "deleteById", null);
164
+ tslib_1.__decorate([
165
+ (0, rest_1.get)('/todo-lists/sync-sequelize-model'),
166
+ (0, rest_1.response)(200),
167
+ tslib_1.__metadata("design:type", Function),
168
+ tslib_1.__metadata("design:paramtypes", []),
169
+ tslib_1.__metadata("design:returntype", Promise)
170
+ ], TodoListController.prototype, "syncSequelizeModel", null);
171
+ TodoListController = tslib_1.__decorate([
172
+ tslib_1.__param(0, (0, repository_1.repository)(repositories_1.TodoListRepository)),
173
+ tslib_1.__metadata("design:paramtypes", [repositories_1.TodoListRepository])
174
+ ], TodoListController);
175
+ exports.TodoListController = TodoListController;
176
+ //# sourceMappingURL=todo-list.controller.js.map
177
+ //# sourceMappingURL=/Users/dianalau/code/loopback/loopback-next/extensions/sequelize/dist/__tests__/fixtures/controllers/todo-list.controller.js.map
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TodoTodoListController = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const repository_1 = require("@loopback/repository");
6
+ const rest_1 = require("@loopback/rest");
7
+ const models_1 = require("../models");
8
+ const repositories_1 = require("../repositories");
9
+ let TodoTodoListController = class TodoTodoListController {
10
+ constructor(todoRepository) {
11
+ this.todoRepository = todoRepository;
12
+ }
13
+ async getTodoList(id) {
14
+ return this.todoRepository.todoList(id);
15
+ }
16
+ };
17
+ tslib_1.__decorate([
18
+ (0, rest_1.get)('/todos/{id}/todo-list', {
19
+ responses: {
20
+ '200': {
21
+ description: 'TodoList belonging to Todo',
22
+ content: {
23
+ 'application/json': {
24
+ schema: { type: 'array', items: (0, rest_1.getModelSchemaRef)(models_1.TodoList) },
25
+ },
26
+ },
27
+ },
28
+ },
29
+ }),
30
+ tslib_1.__param(0, rest_1.param.path.number('id')),
31
+ tslib_1.__metadata("design:type", Function),
32
+ tslib_1.__metadata("design:paramtypes", [Object]),
33
+ tslib_1.__metadata("design:returntype", Promise)
34
+ ], TodoTodoListController.prototype, "getTodoList", null);
35
+ TodoTodoListController = tslib_1.__decorate([
36
+ tslib_1.__param(0, (0, repository_1.repository)(repositories_1.TodoRepository)),
37
+ tslib_1.__metadata("design:paramtypes", [repositories_1.TodoRepository])
38
+ ], TodoTodoListController);
39
+ exports.TodoTodoListController = TodoTodoListController;
40
+ //# sourceMappingURL=todo-todo-list.controller.js.map
41
+ //# sourceMappingURL=/Users/dianalau/code/loopback/loopback-next/extensions/sequelize/dist/__tests__/fixtures/controllers/todo-todo-list.controller.js.map