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