@loopback/sequelize 0.4.0 → 0.5.1
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.
- package/dist/.sandbox/52958FChNfK/application.js +15 -0
- package/dist/.sandbox/52958FChNfK/controllers/book-category.controller.js +40 -0
- package/dist/.sandbox/52958FChNfK/controllers/book.controller.js +209 -0
- package/dist/.sandbox/52958FChNfK/controllers/category.controller.js +197 -0
- package/dist/.sandbox/52958FChNfK/controllers/developer.controller.js +176 -0
- package/dist/.sandbox/52958FChNfK/controllers/doctor-patient.controller.js +111 -0
- package/dist/.sandbox/52958FChNfK/controllers/doctor.controller.js +176 -0
- package/dist/.sandbox/52958FChNfK/controllers/index.js +23 -0
- package/dist/.sandbox/52958FChNfK/controllers/patient.controller.js +164 -0
- package/dist/.sandbox/52958FChNfK/controllers/product.controller.js +176 -0
- package/dist/.sandbox/52958FChNfK/controllers/programming-languange.controller.js +203 -0
- package/dist/.sandbox/52958FChNfK/controllers/task.controller.js +209 -0
- package/dist/.sandbox/52958FChNfK/controllers/test.controller.base.js +27 -0
- package/dist/.sandbox/52958FChNfK/controllers/todo-list-todo.controller.js +112 -0
- package/dist/.sandbox/52958FChNfK/controllers/todo-list.controller.js +176 -0
- package/dist/.sandbox/52958FChNfK/controllers/todo-todo-list.controller.js +40 -0
- package/dist/.sandbox/52958FChNfK/controllers/todo.controller.js +176 -0
- package/dist/.sandbox/52958FChNfK/controllers/transaction.controller.js +156 -0
- package/dist/.sandbox/52958FChNfK/controllers/user-todo-list.controller.js +112 -0
- package/dist/.sandbox/52958FChNfK/controllers/user.controller.js +209 -0
- package/dist/.sandbox/52958FChNfK/datasources/config.js +65 -0
- package/dist/.sandbox/52958FChNfK/datasources/primary.datasource.js +27 -0
- package/dist/.sandbox/52958FChNfK/datasources/secondary.datasource.js +27 -0
- package/dist/.sandbox/52958FChNfK/models/appointment.model.js +36 -0
- package/dist/.sandbox/52958FChNfK/models/book.model.js +47 -0
- package/dist/.sandbox/52958FChNfK/models/category.model.js +31 -0
- package/dist/.sandbox/52958FChNfK/models/developer.model.js +46 -0
- package/dist/.sandbox/52958FChNfK/models/doctor.model.js +43 -0
- package/dist/.sandbox/52958FChNfK/models/index.js +17 -0
- package/dist/.sandbox/52958FChNfK/models/patient.model.js +31 -0
- package/dist/.sandbox/52958FChNfK/models/product.model.js +40 -0
- package/dist/.sandbox/52958FChNfK/models/programming-language.model.js +38 -0
- package/dist/.sandbox/52958FChNfK/models/task.model.js +73 -0
- package/dist/.sandbox/52958FChNfK/models/todo-list.model.js +44 -0
- package/dist/.sandbox/52958FChNfK/models/todo.model.js +43 -0
- package/dist/.sandbox/52958FChNfK/models/user.model.js +90 -0
- package/dist/.sandbox/52958FChNfK/repositories/appointment.repository.js +19 -0
- package/dist/.sandbox/52958FChNfK/repositories/book.repository.js +24 -0
- package/dist/.sandbox/52958FChNfK/repositories/category.repository.js +19 -0
- package/dist/.sandbox/52958FChNfK/repositories/developer.repository.js +24 -0
- package/dist/.sandbox/52958FChNfK/repositories/doctor.repository.js +26 -0
- package/dist/.sandbox/52958FChNfK/repositories/index.js +17 -0
- package/dist/.sandbox/52958FChNfK/repositories/patient.repository.js +19 -0
- package/dist/.sandbox/52958FChNfK/repositories/product.repository.js +19 -0
- package/dist/.sandbox/52958FChNfK/repositories/programming-language.repository.js +19 -0
- package/dist/.sandbox/52958FChNfK/repositories/task.repository.js +25 -0
- package/dist/.sandbox/52958FChNfK/repositories/todo-list.repository.js +24 -0
- package/dist/.sandbox/52958FChNfK/repositories/todo.repository.js +24 -0
- package/dist/.sandbox/52958FChNfK/repositories/user.repository.js +24 -0
- package/dist/sequelize/sequelize.repository.base.d.ts +11 -0
- package/dist/sequelize/sequelize.repository.base.js +30 -3
- package/dist/sequelize/sequelize.repository.base.js.map +1 -1
- package/package.json +12 -12
- package/src/sequelize/sequelize.repository.base.ts +34 -3
|
@@ -0,0 +1,203 @@
|
|
|
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 = exports.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
|
+
exports.ProgrammingLanguangeController = 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
|
+
//# sourceMappingURL=programming-languange.controller.js.map
|
|
203
|
+
//# sourceMappingURL=/Users/dianalau/code/loopback/loopback-next/extensions/sequelize/dist/__tests__/fixtures/controllers/programming-languange.controller.js.map
|
|
@@ -0,0 +1,209 @@
|
|
|
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 = exports.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
|
+
tslib_1.__decorate([
|
|
47
|
+
(0, rest_1.post)('/tasks'),
|
|
48
|
+
(0, rest_1.response)(200, {
|
|
49
|
+
description: 'task model instance',
|
|
50
|
+
content: { 'application/json': { schema: (0, rest_1.getModelSchemaRef)(models_1.Task) } },
|
|
51
|
+
}),
|
|
52
|
+
tslib_1.__param(0, (0, rest_1.requestBody)({
|
|
53
|
+
content: {
|
|
54
|
+
'application/json': {
|
|
55
|
+
schema: (0, rest_1.getModelSchemaRef)(models_1.Task, {
|
|
56
|
+
title: 'NewTask',
|
|
57
|
+
exclude: ['id'],
|
|
58
|
+
}),
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
})),
|
|
62
|
+
tslib_1.__metadata("design:type", Function),
|
|
63
|
+
tslib_1.__metadata("design:paramtypes", [Object]),
|
|
64
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
65
|
+
], TaskController.prototype, "create", null);
|
|
66
|
+
tslib_1.__decorate([
|
|
67
|
+
(0, rest_1.post)('/tasks-bulk'),
|
|
68
|
+
(0, rest_1.response)(200, {
|
|
69
|
+
description: 'task model instances',
|
|
70
|
+
content: {
|
|
71
|
+
'application/json': {
|
|
72
|
+
schema: {
|
|
73
|
+
type: 'array',
|
|
74
|
+
items: (0, rest_1.getModelSchemaRef)(models_1.Task),
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
}),
|
|
79
|
+
tslib_1.__param(0, (0, rest_1.requestBody)({
|
|
80
|
+
content: {
|
|
81
|
+
'application/json': {
|
|
82
|
+
schema: {
|
|
83
|
+
type: 'array',
|
|
84
|
+
items: (0, rest_1.getModelSchemaRef)(models_1.Task, {
|
|
85
|
+
title: 'NewTask',
|
|
86
|
+
exclude: ['id'],
|
|
87
|
+
}),
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
})),
|
|
92
|
+
tslib_1.__metadata("design:type", Function),
|
|
93
|
+
tslib_1.__metadata("design:paramtypes", [Array]),
|
|
94
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
95
|
+
], TaskController.prototype, "createAll", null);
|
|
96
|
+
tslib_1.__decorate([
|
|
97
|
+
(0, rest_1.get)('/tasks/count'),
|
|
98
|
+
(0, rest_1.response)(200, {
|
|
99
|
+
description: 'Task model count',
|
|
100
|
+
content: { 'application/json': { schema: repository_1.CountSchema } },
|
|
101
|
+
}),
|
|
102
|
+
tslib_1.__param(0, rest_1.param.where(models_1.Task)),
|
|
103
|
+
tslib_1.__metadata("design:type", Function),
|
|
104
|
+
tslib_1.__metadata("design:paramtypes", [Object]),
|
|
105
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
106
|
+
], TaskController.prototype, "count", null);
|
|
107
|
+
tslib_1.__decorate([
|
|
108
|
+
(0, rest_1.get)('/tasks'),
|
|
109
|
+
(0, rest_1.response)(200, {
|
|
110
|
+
description: 'Array of Task model instances',
|
|
111
|
+
content: {
|
|
112
|
+
'application/json': {
|
|
113
|
+
schema: {
|
|
114
|
+
type: 'array',
|
|
115
|
+
items: (0, rest_1.getModelSchemaRef)(models_1.Task, { includeRelations: true }),
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
}),
|
|
120
|
+
tslib_1.__param(0, rest_1.param.filter(models_1.Task)),
|
|
121
|
+
tslib_1.__metadata("design:type", Function),
|
|
122
|
+
tslib_1.__metadata("design:paramtypes", [Object]),
|
|
123
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
124
|
+
], TaskController.prototype, "find", null);
|
|
125
|
+
tslib_1.__decorate([
|
|
126
|
+
(0, rest_1.patch)('/tasks'),
|
|
127
|
+
(0, rest_1.response)(200, {
|
|
128
|
+
description: 'Task 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.Task, { partial: true }),
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
})),
|
|
138
|
+
tslib_1.__param(1, rest_1.param.where(models_1.Task)),
|
|
139
|
+
tslib_1.__metadata("design:type", Function),
|
|
140
|
+
tslib_1.__metadata("design:paramtypes", [models_1.Task, Object]),
|
|
141
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
142
|
+
], TaskController.prototype, "updateAll", null);
|
|
143
|
+
tslib_1.__decorate([
|
|
144
|
+
(0, rest_1.get)('/tasks/{id}'),
|
|
145
|
+
(0, rest_1.response)(200, {
|
|
146
|
+
description: 'Task model instance',
|
|
147
|
+
content: {
|
|
148
|
+
'application/json': {
|
|
149
|
+
schema: (0, rest_1.getModelSchemaRef)(models_1.Task, { includeRelations: true }),
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
}),
|
|
153
|
+
tslib_1.__param(0, rest_1.param.path.number('id')),
|
|
154
|
+
tslib_1.__param(1, rest_1.param.filter(models_1.Task, { exclude: 'where' })),
|
|
155
|
+
tslib_1.__metadata("design:type", Function),
|
|
156
|
+
tslib_1.__metadata("design:paramtypes", [Number, Object]),
|
|
157
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
158
|
+
], TaskController.prototype, "findById", null);
|
|
159
|
+
tslib_1.__decorate([
|
|
160
|
+
(0, rest_1.patch)('/tasks/{id}'),
|
|
161
|
+
(0, rest_1.response)(204, {
|
|
162
|
+
description: 'Task PATCH success',
|
|
163
|
+
}),
|
|
164
|
+
tslib_1.__param(0, rest_1.param.path.number('id')),
|
|
165
|
+
tslib_1.__param(1, (0, rest_1.requestBody)({
|
|
166
|
+
content: {
|
|
167
|
+
'application/json': {
|
|
168
|
+
schema: (0, rest_1.getModelSchemaRef)(models_1.Task, { partial: true }),
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
})),
|
|
172
|
+
tslib_1.__metadata("design:type", Function),
|
|
173
|
+
tslib_1.__metadata("design:paramtypes", [Number, models_1.Task]),
|
|
174
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
175
|
+
], TaskController.prototype, "updateById", null);
|
|
176
|
+
tslib_1.__decorate([
|
|
177
|
+
(0, rest_1.put)('/tasks/{id}'),
|
|
178
|
+
(0, rest_1.response)(204, {
|
|
179
|
+
description: 'Task PUT success',
|
|
180
|
+
}),
|
|
181
|
+
tslib_1.__param(0, rest_1.param.path.number('id')),
|
|
182
|
+
tslib_1.__param(1, (0, rest_1.requestBody)()),
|
|
183
|
+
tslib_1.__metadata("design:type", Function),
|
|
184
|
+
tslib_1.__metadata("design:paramtypes", [Number, models_1.Task]),
|
|
185
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
186
|
+
], TaskController.prototype, "replaceById", null);
|
|
187
|
+
tslib_1.__decorate([
|
|
188
|
+
(0, rest_1.del)('/tasks/{id}'),
|
|
189
|
+
(0, rest_1.response)(204, {
|
|
190
|
+
description: 'Task DELETE success',
|
|
191
|
+
}),
|
|
192
|
+
tslib_1.__param(0, rest_1.param.path.number('id')),
|
|
193
|
+
tslib_1.__metadata("design:type", Function),
|
|
194
|
+
tslib_1.__metadata("design:paramtypes", [Number]),
|
|
195
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
196
|
+
], TaskController.prototype, "deleteById", null);
|
|
197
|
+
tslib_1.__decorate([
|
|
198
|
+
(0, rest_1.get)('/tasks/sync-sequelize-model'),
|
|
199
|
+
(0, rest_1.response)(200),
|
|
200
|
+
tslib_1.__metadata("design:type", Function),
|
|
201
|
+
tslib_1.__metadata("design:paramtypes", []),
|
|
202
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
203
|
+
], TaskController.prototype, "syncSequelizeModel", null);
|
|
204
|
+
exports.TaskController = TaskController = tslib_1.__decorate([
|
|
205
|
+
tslib_1.__param(0, (0, repository_1.repository)(repositories_1.TaskRepository)),
|
|
206
|
+
tslib_1.__metadata("design:paramtypes", [repositories_1.TaskRepository])
|
|
207
|
+
], TaskController);
|
|
208
|
+
//# sourceMappingURL=task.controller.js.map
|
|
209
|
+
//# sourceMappingURL=/Users/dianalau/code/loopback/loopback-next/extensions/sequelize/dist/__tests__/fixtures/controllers/task.controller.js.map
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
|
@@ -0,0 +1,112 @@
|
|
|
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 = exports.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
|
+
exports.TodoListTodoController = 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
|
+
//# sourceMappingURL=todo-list-todo.controller.js.map
|
|
112
|
+
//# sourceMappingURL=/Users/dianalau/code/loopback/loopback-next/extensions/sequelize/dist/__tests__/fixtures/controllers/todo-list-todo.controller.js.map
|