@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.
- package/LICENSE +25 -0
- package/README.md +194 -0
- package/dist/.sandbox/6646miobBk/application.js +15 -0
- package/dist/.sandbox/6646miobBk/controllers/book-category.controller.js +41 -0
- package/dist/.sandbox/6646miobBk/controllers/book.controller.js +210 -0
- package/dist/.sandbox/6646miobBk/controllers/category.controller.js +198 -0
- package/dist/.sandbox/6646miobBk/controllers/developer.controller.js +177 -0
- package/dist/.sandbox/6646miobBk/controllers/doctor-patient.controller.js +112 -0
- package/dist/.sandbox/6646miobBk/controllers/doctor.controller.js +177 -0
- package/dist/.sandbox/6646miobBk/controllers/index.js +20 -0
- package/dist/.sandbox/6646miobBk/controllers/patient.controller.js +165 -0
- package/dist/.sandbox/6646miobBk/controllers/programming-languange.controller.js +204 -0
- package/dist/.sandbox/6646miobBk/controllers/test.controller.base.js +25 -0
- package/dist/.sandbox/6646miobBk/controllers/todo-list-todo.controller.js +113 -0
- package/dist/.sandbox/6646miobBk/controllers/todo-list.controller.js +177 -0
- package/dist/.sandbox/6646miobBk/controllers/todo-todo-list.controller.js +41 -0
- package/dist/.sandbox/6646miobBk/controllers/todo.controller.js +177 -0
- package/dist/.sandbox/6646miobBk/controllers/user-todo-list.controller.js +113 -0
- package/dist/.sandbox/6646miobBk/controllers/user.controller.js +210 -0
- package/dist/.sandbox/6646miobBk/datasources/db.datasource.js +28 -0
- package/dist/.sandbox/6646miobBk/models/appointment.model.js +37 -0
- package/dist/.sandbox/6646miobBk/models/book.model.js +48 -0
- package/dist/.sandbox/6646miobBk/models/category.model.js +32 -0
- package/dist/.sandbox/6646miobBk/models/developer.model.js +40 -0
- package/dist/.sandbox/6646miobBk/models/doctor.model.js +44 -0
- package/dist/.sandbox/6646miobBk/models/index.js +15 -0
- package/dist/.sandbox/6646miobBk/models/patient.model.js +32 -0
- package/dist/.sandbox/6646miobBk/models/programming-language.model.js +32 -0
- package/dist/.sandbox/6646miobBk/models/todo-list.model.js +45 -0
- package/dist/.sandbox/6646miobBk/models/todo.model.js +44 -0
- package/dist/.sandbox/6646miobBk/models/user.model.js +85 -0
- package/dist/.sandbox/6646miobBk/repositories/appointment.repository.js +20 -0
- package/dist/.sandbox/6646miobBk/repositories/book.repository.js +25 -0
- package/dist/.sandbox/6646miobBk/repositories/category.repository.js +20 -0
- package/dist/.sandbox/6646miobBk/repositories/developer.repository.js +25 -0
- package/dist/.sandbox/6646miobBk/repositories/doctor.repository.js +27 -0
- package/dist/.sandbox/6646miobBk/repositories/index.js +15 -0
- package/dist/.sandbox/6646miobBk/repositories/patient.repository.js +20 -0
- package/dist/.sandbox/6646miobBk/repositories/programming-language.repository.js +20 -0
- package/dist/.sandbox/6646miobBk/repositories/todo-list.repository.js +25 -0
- package/dist/.sandbox/6646miobBk/repositories/todo.repository.js +25 -0
- package/dist/.sandbox/6646miobBk/repositories/user.repository.js +29 -0
- package/dist/component.d.ts +7 -0
- package/dist/component.js +30 -0
- package/dist/component.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/keys.d.ts +8 -0
- package/dist/keys.js +16 -0
- package/dist/keys.js.map +1 -0
- package/dist/sequelize/connector-mapping.d.ts +9 -0
- package/dist/sequelize/connector-mapping.js +19 -0
- package/dist/sequelize/connector-mapping.js.map +1 -0
- package/dist/sequelize/index.d.ts +2 -0
- package/dist/sequelize/index.js +10 -0
- package/dist/sequelize/index.js.map +1 -0
- package/dist/sequelize/operator-translation.d.ts +8 -0
- package/dist/sequelize/operator-translation.js +31 -0
- package/dist/sequelize/operator-translation.js.map +1 -0
- package/dist/sequelize/sequelize.datasource.base.d.ts +23 -0
- package/dist/sequelize/sequelize.datasource.base.js +60 -0
- package/dist/sequelize/sequelize.datasource.base.js.map +1 -0
- package/dist/sequelize/sequelize.model.d.ts +7 -0
- package/dist/sequelize/sequelize.model.js +24 -0
- package/dist/sequelize/sequelize.model.js.map +1 -0
- package/dist/sequelize/sequelize.repository.base.d.ts +231 -0
- package/dist/sequelize/sequelize.repository.base.js +835 -0
- package/dist/sequelize/sequelize.repository.base.js.map +1 -0
- package/dist/sequelize/utils.d.ts +6 -0
- package/dist/sequelize/utils.js +17 -0
- package/dist/sequelize/utils.js.map +1 -0
- package/dist/types.d.ts +9 -0
- package/dist/types.js +14 -0
- package/dist/types.js.map +1 -0
- package/package.json +64 -0
- package/src/component.ts +34 -0
- package/src/index.ts +9 -0
- package/src/keys.ts +16 -0
- package/src/sequelize/connector-mapping.ts +26 -0
- package/src/sequelize/index.ts +7 -0
- package/src/sequelize/operator-translation.ts +32 -0
- package/src/sequelize/sequelize.datasource.base.ts +81 -0
- package/src/sequelize/sequelize.model.ts +22 -0
- package/src/sequelize/sequelize.repository.base.ts +1246 -0
- package/src/sequelize/utils.ts +13 -0
- package/src/types.ts +19 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeveloperController = 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 DeveloperController = class DeveloperController extends test_controller_base_1.TestControllerBase {
|
|
11
|
+
constructor(developerRepository) {
|
|
12
|
+
super(developerRepository);
|
|
13
|
+
this.developerRepository = developerRepository;
|
|
14
|
+
}
|
|
15
|
+
async create(developer) {
|
|
16
|
+
return this.developerRepository.create(developer);
|
|
17
|
+
}
|
|
18
|
+
async count(where) {
|
|
19
|
+
return this.developerRepository.count(where);
|
|
20
|
+
}
|
|
21
|
+
async find(filter) {
|
|
22
|
+
return this.developerRepository.find(filter);
|
|
23
|
+
}
|
|
24
|
+
async updateAll(developer, where) {
|
|
25
|
+
return this.developerRepository.updateAll(developer, where);
|
|
26
|
+
}
|
|
27
|
+
async findById(id, filter) {
|
|
28
|
+
return this.developerRepository.findById(id, filter);
|
|
29
|
+
}
|
|
30
|
+
async updateById(id, developer) {
|
|
31
|
+
await this.developerRepository.updateById(id, developer);
|
|
32
|
+
}
|
|
33
|
+
async replaceById(id, developer) {
|
|
34
|
+
await this.developerRepository.replaceById(id, developer);
|
|
35
|
+
}
|
|
36
|
+
async deleteById(id) {
|
|
37
|
+
await this.developerRepository.deleteById(id);
|
|
38
|
+
}
|
|
39
|
+
async syncSequelizeModel() {
|
|
40
|
+
await this.beforeEach({ syncAll: true });
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
tslib_1.__decorate([
|
|
44
|
+
(0, rest_1.post)('/developers'),
|
|
45
|
+
(0, rest_1.response)(200, {
|
|
46
|
+
description: 'Developer model instance',
|
|
47
|
+
content: { 'application/json': { schema: (0, rest_1.getModelSchemaRef)(models_1.Developer) } },
|
|
48
|
+
}),
|
|
49
|
+
tslib_1.__param(0, (0, rest_1.requestBody)({
|
|
50
|
+
content: {
|
|
51
|
+
'application/json': {
|
|
52
|
+
schema: (0, rest_1.getModelSchemaRef)(models_1.Developer, {
|
|
53
|
+
title: 'NewDeveloper',
|
|
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
|
+
], DeveloperController.prototype, "create", null);
|
|
63
|
+
tslib_1.__decorate([
|
|
64
|
+
(0, rest_1.get)('/developers/count'),
|
|
65
|
+
(0, rest_1.response)(200, {
|
|
66
|
+
description: 'Developer model count',
|
|
67
|
+
content: { 'application/json': { schema: repository_1.CountSchema } },
|
|
68
|
+
}),
|
|
69
|
+
tslib_1.__param(0, rest_1.param.where(models_1.Developer)),
|
|
70
|
+
tslib_1.__metadata("design:type", Function),
|
|
71
|
+
tslib_1.__metadata("design:paramtypes", [Object]),
|
|
72
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
73
|
+
], DeveloperController.prototype, "count", null);
|
|
74
|
+
tslib_1.__decorate([
|
|
75
|
+
(0, rest_1.get)('/developers'),
|
|
76
|
+
(0, rest_1.response)(200, {
|
|
77
|
+
description: 'Array of Developer model instances',
|
|
78
|
+
content: {
|
|
79
|
+
'application/json': {
|
|
80
|
+
schema: {
|
|
81
|
+
type: 'array',
|
|
82
|
+
items: (0, rest_1.getModelSchemaRef)(models_1.Developer, { includeRelations: true }),
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
}),
|
|
87
|
+
tslib_1.__param(0, rest_1.param.filter(models_1.Developer)),
|
|
88
|
+
tslib_1.__metadata("design:type", Function),
|
|
89
|
+
tslib_1.__metadata("design:paramtypes", [Object]),
|
|
90
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
91
|
+
], DeveloperController.prototype, "find", null);
|
|
92
|
+
tslib_1.__decorate([
|
|
93
|
+
(0, rest_1.patch)('/developers'),
|
|
94
|
+
(0, rest_1.response)(200, {
|
|
95
|
+
description: 'Developer 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.Developer, { partial: true }),
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
})),
|
|
105
|
+
tslib_1.__param(1, rest_1.param.where(models_1.Developer)),
|
|
106
|
+
tslib_1.__metadata("design:type", Function),
|
|
107
|
+
tslib_1.__metadata("design:paramtypes", [models_1.Developer, Object]),
|
|
108
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
109
|
+
], DeveloperController.prototype, "updateAll", null);
|
|
110
|
+
tslib_1.__decorate([
|
|
111
|
+
(0, rest_1.get)('/developers/{id}'),
|
|
112
|
+
(0, rest_1.response)(200, {
|
|
113
|
+
description: 'Developer model instance',
|
|
114
|
+
content: {
|
|
115
|
+
'application/json': {
|
|
116
|
+
schema: (0, rest_1.getModelSchemaRef)(models_1.Developer, { 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.Developer, { 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
|
+
], DeveloperController.prototype, "findById", null);
|
|
126
|
+
tslib_1.__decorate([
|
|
127
|
+
(0, rest_1.patch)('/developers/{id}'),
|
|
128
|
+
(0, rest_1.response)(204, {
|
|
129
|
+
description: 'Developer 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.Developer, { partial: true }),
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
})),
|
|
139
|
+
tslib_1.__metadata("design:type", Function),
|
|
140
|
+
tslib_1.__metadata("design:paramtypes", [Number, models_1.Developer]),
|
|
141
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
142
|
+
], DeveloperController.prototype, "updateById", null);
|
|
143
|
+
tslib_1.__decorate([
|
|
144
|
+
(0, rest_1.put)('/developers/{id}'),
|
|
145
|
+
(0, rest_1.response)(204, {
|
|
146
|
+
description: 'Developer 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.Developer]),
|
|
152
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
153
|
+
], DeveloperController.prototype, "replaceById", null);
|
|
154
|
+
tslib_1.__decorate([
|
|
155
|
+
(0, rest_1.del)('/developers/{id}'),
|
|
156
|
+
(0, rest_1.response)(204, {
|
|
157
|
+
description: 'Developer 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
|
+
], DeveloperController.prototype, "deleteById", null);
|
|
164
|
+
tslib_1.__decorate([
|
|
165
|
+
(0, rest_1.get)('/developers/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
|
+
], DeveloperController.prototype, "syncSequelizeModel", null);
|
|
171
|
+
DeveloperController = tslib_1.__decorate([
|
|
172
|
+
tslib_1.__param(0, (0, repository_1.repository)(repositories_1.DeveloperRepository)),
|
|
173
|
+
tslib_1.__metadata("design:paramtypes", [repositories_1.DeveloperRepository])
|
|
174
|
+
], DeveloperController);
|
|
175
|
+
exports.DeveloperController = DeveloperController;
|
|
176
|
+
//# sourceMappingURL=developer.controller.js.map
|
|
177
|
+
//# sourceMappingURL=/Users/dianalau/code/loopback/loopback-next/extensions/sequelize/dist/__tests__/fixtures/controllers/developer.controller.js.map
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DoctorPatientController = 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 DoctorPatientController = class DoctorPatientController {
|
|
10
|
+
constructor(doctorRepository) {
|
|
11
|
+
this.doctorRepository = doctorRepository;
|
|
12
|
+
}
|
|
13
|
+
async find(id, filter) {
|
|
14
|
+
return this.doctorRepository.patients(id).find(filter);
|
|
15
|
+
}
|
|
16
|
+
async create(id, patient) {
|
|
17
|
+
return this.doctorRepository.patients(id).create(patient);
|
|
18
|
+
}
|
|
19
|
+
async patch(id, patient, where) {
|
|
20
|
+
return this.doctorRepository.patients(id).patch(patient, where);
|
|
21
|
+
}
|
|
22
|
+
async delete(id, where) {
|
|
23
|
+
return this.doctorRepository.patients(id).delete(where);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
tslib_1.__decorate([
|
|
27
|
+
(0, rest_1.get)('/doctors/{id}/patients', {
|
|
28
|
+
responses: {
|
|
29
|
+
'200': {
|
|
30
|
+
description: 'Array of Doctor has many Patient through Appointment',
|
|
31
|
+
content: {
|
|
32
|
+
'application/json': {
|
|
33
|
+
schema: { type: 'array', items: (0, rest_1.getModelSchemaRef)(models_1.Patient) },
|
|
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
|
+
], DoctorPatientController.prototype, "find", null);
|
|
45
|
+
tslib_1.__decorate([
|
|
46
|
+
(0, rest_1.post)('/doctors/{id}/patients', {
|
|
47
|
+
responses: {
|
|
48
|
+
'200': {
|
|
49
|
+
description: 'create a Patient model instance',
|
|
50
|
+
content: { 'application/json': { schema: (0, rest_1.getModelSchemaRef)(models_1.Patient) } },
|
|
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.Patient, {
|
|
59
|
+
title: 'NewPatientInDoctor',
|
|
60
|
+
exclude: ['id'],
|
|
61
|
+
}),
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
})),
|
|
65
|
+
tslib_1.__metadata("design:type", Function),
|
|
66
|
+
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
|
67
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
68
|
+
], DoctorPatientController.prototype, "create", null);
|
|
69
|
+
tslib_1.__decorate([
|
|
70
|
+
(0, rest_1.patch)('/doctors/{id}/patients', {
|
|
71
|
+
responses: {
|
|
72
|
+
'200': {
|
|
73
|
+
description: 'Doctor.Patient PATCH success count',
|
|
74
|
+
content: { 'application/json': { schema: repository_1.CountSchema } },
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
}),
|
|
78
|
+
tslib_1.__param(0, rest_1.param.path.number('id')),
|
|
79
|
+
tslib_1.__param(1, (0, rest_1.requestBody)({
|
|
80
|
+
content: {
|
|
81
|
+
'application/json': {
|
|
82
|
+
schema: (0, rest_1.getModelSchemaRef)(models_1.Patient, { partial: true }),
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
})),
|
|
86
|
+
tslib_1.__param(2, rest_1.param.query.object('where', (0, rest_1.getWhereSchemaFor)(models_1.Patient))),
|
|
87
|
+
tslib_1.__metadata("design:type", Function),
|
|
88
|
+
tslib_1.__metadata("design:paramtypes", [Number, Object, Object]),
|
|
89
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
90
|
+
], DoctorPatientController.prototype, "patch", null);
|
|
91
|
+
tslib_1.__decorate([
|
|
92
|
+
(0, rest_1.del)('/doctors/{id}/patients', {
|
|
93
|
+
responses: {
|
|
94
|
+
'200': {
|
|
95
|
+
description: 'Doctor.Patient DELETE success count',
|
|
96
|
+
content: { 'application/json': { schema: repository_1.CountSchema } },
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
}),
|
|
100
|
+
tslib_1.__param(0, rest_1.param.path.number('id')),
|
|
101
|
+
tslib_1.__param(1, rest_1.param.query.object('where', (0, rest_1.getWhereSchemaFor)(models_1.Patient))),
|
|
102
|
+
tslib_1.__metadata("design:type", Function),
|
|
103
|
+
tslib_1.__metadata("design:paramtypes", [Number, Object]),
|
|
104
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
105
|
+
], DoctorPatientController.prototype, "delete", null);
|
|
106
|
+
DoctorPatientController = tslib_1.__decorate([
|
|
107
|
+
tslib_1.__param(0, (0, repository_1.repository)(repositories_1.DoctorRepository)),
|
|
108
|
+
tslib_1.__metadata("design:paramtypes", [repositories_1.DoctorRepository])
|
|
109
|
+
], DoctorPatientController);
|
|
110
|
+
exports.DoctorPatientController = DoctorPatientController;
|
|
111
|
+
//# sourceMappingURL=doctor-patient.controller.js.map
|
|
112
|
+
//# sourceMappingURL=/Users/dianalau/code/loopback/loopback-next/extensions/sequelize/dist/__tests__/fixtures/controllers/doctor-patient.controller.js.map
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DoctorController = 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 DoctorController = class DoctorController extends test_controller_base_1.TestControllerBase {
|
|
11
|
+
constructor(doctorRepository) {
|
|
12
|
+
super(doctorRepository);
|
|
13
|
+
this.doctorRepository = doctorRepository;
|
|
14
|
+
}
|
|
15
|
+
async create(doctor) {
|
|
16
|
+
return this.doctorRepository.create(doctor);
|
|
17
|
+
}
|
|
18
|
+
async count(where) {
|
|
19
|
+
return this.doctorRepository.count(where);
|
|
20
|
+
}
|
|
21
|
+
async find(filter) {
|
|
22
|
+
return this.doctorRepository.find(filter);
|
|
23
|
+
}
|
|
24
|
+
async updateAll(doctor, where) {
|
|
25
|
+
return this.doctorRepository.updateAll(doctor, where);
|
|
26
|
+
}
|
|
27
|
+
async findById(id, filter) {
|
|
28
|
+
return this.doctorRepository.findById(id, filter);
|
|
29
|
+
}
|
|
30
|
+
async updateById(id, doctor) {
|
|
31
|
+
await this.doctorRepository.updateById(id, doctor);
|
|
32
|
+
}
|
|
33
|
+
async replaceById(id, doctor) {
|
|
34
|
+
await this.doctorRepository.replaceById(id, doctor);
|
|
35
|
+
}
|
|
36
|
+
async deleteById(id) {
|
|
37
|
+
await this.doctorRepository.deleteById(id);
|
|
38
|
+
}
|
|
39
|
+
async syncSequelizeModel() {
|
|
40
|
+
await this.beforeEach({ syncAll: true });
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
tslib_1.__decorate([
|
|
44
|
+
(0, rest_1.post)('/doctors'),
|
|
45
|
+
(0, rest_1.response)(200, {
|
|
46
|
+
description: 'Doctor model instance',
|
|
47
|
+
content: { 'application/json': { schema: (0, rest_1.getModelSchemaRef)(models_1.Doctor) } },
|
|
48
|
+
}),
|
|
49
|
+
tslib_1.__param(0, (0, rest_1.requestBody)({
|
|
50
|
+
content: {
|
|
51
|
+
'application/json': {
|
|
52
|
+
schema: (0, rest_1.getModelSchemaRef)(models_1.Doctor, {
|
|
53
|
+
title: 'NewDoctor',
|
|
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
|
+
], DoctorController.prototype, "create", null);
|
|
63
|
+
tslib_1.__decorate([
|
|
64
|
+
(0, rest_1.get)('/doctors/count'),
|
|
65
|
+
(0, rest_1.response)(200, {
|
|
66
|
+
description: 'Doctor model count',
|
|
67
|
+
content: { 'application/json': { schema: repository_1.CountSchema } },
|
|
68
|
+
}),
|
|
69
|
+
tslib_1.__param(0, rest_1.param.where(models_1.Doctor)),
|
|
70
|
+
tslib_1.__metadata("design:type", Function),
|
|
71
|
+
tslib_1.__metadata("design:paramtypes", [Object]),
|
|
72
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
73
|
+
], DoctorController.prototype, "count", null);
|
|
74
|
+
tslib_1.__decorate([
|
|
75
|
+
(0, rest_1.get)('/doctors'),
|
|
76
|
+
(0, rest_1.response)(200, {
|
|
77
|
+
description: 'Array of Doctor model instances',
|
|
78
|
+
content: {
|
|
79
|
+
'application/json': {
|
|
80
|
+
schema: {
|
|
81
|
+
type: 'array',
|
|
82
|
+
items: (0, rest_1.getModelSchemaRef)(models_1.Doctor, { includeRelations: true }),
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
}),
|
|
87
|
+
tslib_1.__param(0, rest_1.param.filter(models_1.Doctor)),
|
|
88
|
+
tslib_1.__metadata("design:type", Function),
|
|
89
|
+
tslib_1.__metadata("design:paramtypes", [Object]),
|
|
90
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
91
|
+
], DoctorController.prototype, "find", null);
|
|
92
|
+
tslib_1.__decorate([
|
|
93
|
+
(0, rest_1.patch)('/doctors'),
|
|
94
|
+
(0, rest_1.response)(200, {
|
|
95
|
+
description: 'Doctor 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.Doctor, { partial: true }),
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
})),
|
|
105
|
+
tslib_1.__param(1, rest_1.param.where(models_1.Doctor)),
|
|
106
|
+
tslib_1.__metadata("design:type", Function),
|
|
107
|
+
tslib_1.__metadata("design:paramtypes", [models_1.Doctor, Object]),
|
|
108
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
109
|
+
], DoctorController.prototype, "updateAll", null);
|
|
110
|
+
tslib_1.__decorate([
|
|
111
|
+
(0, rest_1.get)('/doctors/{id}'),
|
|
112
|
+
(0, rest_1.response)(200, {
|
|
113
|
+
description: 'Doctor model instance',
|
|
114
|
+
content: {
|
|
115
|
+
'application/json': {
|
|
116
|
+
schema: (0, rest_1.getModelSchemaRef)(models_1.Doctor, { 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.Doctor, { 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
|
+
], DoctorController.prototype, "findById", null);
|
|
126
|
+
tslib_1.__decorate([
|
|
127
|
+
(0, rest_1.patch)('/doctors/{id}'),
|
|
128
|
+
(0, rest_1.response)(204, {
|
|
129
|
+
description: 'Doctor 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.Doctor, { partial: true }),
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
})),
|
|
139
|
+
tslib_1.__metadata("design:type", Function),
|
|
140
|
+
tslib_1.__metadata("design:paramtypes", [Number, models_1.Doctor]),
|
|
141
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
142
|
+
], DoctorController.prototype, "updateById", null);
|
|
143
|
+
tslib_1.__decorate([
|
|
144
|
+
(0, rest_1.put)('/doctors/{id}'),
|
|
145
|
+
(0, rest_1.response)(204, {
|
|
146
|
+
description: 'Doctor 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.Doctor]),
|
|
152
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
153
|
+
], DoctorController.prototype, "replaceById", null);
|
|
154
|
+
tslib_1.__decorate([
|
|
155
|
+
(0, rest_1.del)('/doctors/{id}'),
|
|
156
|
+
(0, rest_1.response)(204, {
|
|
157
|
+
description: 'Doctor 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
|
+
], DoctorController.prototype, "deleteById", null);
|
|
164
|
+
tslib_1.__decorate([
|
|
165
|
+
(0, rest_1.get)('/doctors/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
|
+
], DoctorController.prototype, "syncSequelizeModel", null);
|
|
171
|
+
DoctorController = tslib_1.__decorate([
|
|
172
|
+
tslib_1.__param(0, (0, repository_1.repository)(repositories_1.DoctorRepository)),
|
|
173
|
+
tslib_1.__metadata("design:paramtypes", [repositories_1.DoctorRepository])
|
|
174
|
+
], DoctorController);
|
|
175
|
+
exports.DoctorController = DoctorController;
|
|
176
|
+
//# sourceMappingURL=doctor.controller.js.map
|
|
177
|
+
//# sourceMappingURL=/Users/dianalau/code/loopback/loopback-next/extensions/sequelize/dist/__tests__/fixtures/controllers/doctor.controller.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./book-category.controller"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./book.controller"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./category.controller"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./developer.controller"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./doctor-patient.controller"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./doctor.controller"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./patient.controller"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./programming-languange.controller"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./test.controller.base"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./todo-list-todo.controller"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./todo-list.controller"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./todo-todo-list.controller"), exports);
|
|
16
|
+
tslib_1.__exportStar(require("./todo.controller"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./user-todo-list.controller"), exports);
|
|
18
|
+
tslib_1.__exportStar(require("./user.controller"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
20
|
+
//# sourceMappingURL=/Users/dianalau/code/loopback/loopback-next/extensions/sequelize/dist/__tests__/fixtures/controllers/index.js.map
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PatientController = 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 PatientController = class PatientController {
|
|
10
|
+
constructor(patientRepository) {
|
|
11
|
+
this.patientRepository = patientRepository;
|
|
12
|
+
}
|
|
13
|
+
async create(patient) {
|
|
14
|
+
return this.patientRepository.create(patient);
|
|
15
|
+
}
|
|
16
|
+
async count(where) {
|
|
17
|
+
return this.patientRepository.count(where);
|
|
18
|
+
}
|
|
19
|
+
async find(filter) {
|
|
20
|
+
return this.patientRepository.find(filter);
|
|
21
|
+
}
|
|
22
|
+
async updateAll(patient, where) {
|
|
23
|
+
return this.patientRepository.updateAll(patient, where);
|
|
24
|
+
}
|
|
25
|
+
async findById(id, filter) {
|
|
26
|
+
return this.patientRepository.findById(id, filter);
|
|
27
|
+
}
|
|
28
|
+
async updateById(id, patient) {
|
|
29
|
+
await this.patientRepository.updateById(id, patient);
|
|
30
|
+
}
|
|
31
|
+
async replaceById(id, patient) {
|
|
32
|
+
await this.patientRepository.replaceById(id, patient);
|
|
33
|
+
}
|
|
34
|
+
async deleteById(id) {
|
|
35
|
+
await this.patientRepository.deleteById(id);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
tslib_1.__decorate([
|
|
39
|
+
(0, rest_1.post)('/patients'),
|
|
40
|
+
(0, rest_1.response)(200, {
|
|
41
|
+
description: 'Patient model instance',
|
|
42
|
+
content: { 'application/json': { schema: (0, rest_1.getModelSchemaRef)(models_1.Patient) } },
|
|
43
|
+
}),
|
|
44
|
+
tslib_1.__param(0, (0, rest_1.requestBody)({
|
|
45
|
+
content: {
|
|
46
|
+
'application/json': {
|
|
47
|
+
schema: (0, rest_1.getModelSchemaRef)(models_1.Patient, {
|
|
48
|
+
title: 'NewPatient',
|
|
49
|
+
exclude: ['id'],
|
|
50
|
+
}),
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
})),
|
|
54
|
+
tslib_1.__metadata("design:type", Function),
|
|
55
|
+
tslib_1.__metadata("design:paramtypes", [Object]),
|
|
56
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
57
|
+
], PatientController.prototype, "create", null);
|
|
58
|
+
tslib_1.__decorate([
|
|
59
|
+
(0, rest_1.get)('/patients/count'),
|
|
60
|
+
(0, rest_1.response)(200, {
|
|
61
|
+
description: 'Patient model count',
|
|
62
|
+
content: { 'application/json': { schema: repository_1.CountSchema } },
|
|
63
|
+
}),
|
|
64
|
+
tslib_1.__param(0, rest_1.param.where(models_1.Patient)),
|
|
65
|
+
tslib_1.__metadata("design:type", Function),
|
|
66
|
+
tslib_1.__metadata("design:paramtypes", [Object]),
|
|
67
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
68
|
+
], PatientController.prototype, "count", null);
|
|
69
|
+
tslib_1.__decorate([
|
|
70
|
+
(0, rest_1.get)('/patients'),
|
|
71
|
+
(0, rest_1.response)(200, {
|
|
72
|
+
description: 'Array of Patient model instances',
|
|
73
|
+
content: {
|
|
74
|
+
'application/json': {
|
|
75
|
+
schema: {
|
|
76
|
+
type: 'array',
|
|
77
|
+
items: (0, rest_1.getModelSchemaRef)(models_1.Patient, { includeRelations: true }),
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
}),
|
|
82
|
+
tslib_1.__param(0, rest_1.param.filter(models_1.Patient)),
|
|
83
|
+
tslib_1.__metadata("design:type", Function),
|
|
84
|
+
tslib_1.__metadata("design:paramtypes", [Object]),
|
|
85
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
86
|
+
], PatientController.prototype, "find", null);
|
|
87
|
+
tslib_1.__decorate([
|
|
88
|
+
(0, rest_1.patch)('/patients'),
|
|
89
|
+
(0, rest_1.response)(200, {
|
|
90
|
+
description: 'Patient PATCH success count',
|
|
91
|
+
content: { 'application/json': { schema: repository_1.CountSchema } },
|
|
92
|
+
}),
|
|
93
|
+
tslib_1.__param(0, (0, rest_1.requestBody)({
|
|
94
|
+
content: {
|
|
95
|
+
'application/json': {
|
|
96
|
+
schema: (0, rest_1.getModelSchemaRef)(models_1.Patient, { partial: true }),
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
})),
|
|
100
|
+
tslib_1.__param(1, rest_1.param.where(models_1.Patient)),
|
|
101
|
+
tslib_1.__metadata("design:type", Function),
|
|
102
|
+
tslib_1.__metadata("design:paramtypes", [models_1.Patient, Object]),
|
|
103
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
104
|
+
], PatientController.prototype, "updateAll", null);
|
|
105
|
+
tslib_1.__decorate([
|
|
106
|
+
(0, rest_1.get)('/patients/{id}'),
|
|
107
|
+
(0, rest_1.response)(200, {
|
|
108
|
+
description: 'Patient model instance',
|
|
109
|
+
content: {
|
|
110
|
+
'application/json': {
|
|
111
|
+
schema: (0, rest_1.getModelSchemaRef)(models_1.Patient, { includeRelations: true }),
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
}),
|
|
115
|
+
tslib_1.__param(0, rest_1.param.path.number('id')),
|
|
116
|
+
tslib_1.__param(1, rest_1.param.filter(models_1.Patient, { exclude: 'where' })),
|
|
117
|
+
tslib_1.__metadata("design:type", Function),
|
|
118
|
+
tslib_1.__metadata("design:paramtypes", [Number, Object]),
|
|
119
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
120
|
+
], PatientController.prototype, "findById", null);
|
|
121
|
+
tslib_1.__decorate([
|
|
122
|
+
(0, rest_1.patch)('/patients/{id}'),
|
|
123
|
+
(0, rest_1.response)(204, {
|
|
124
|
+
description: 'Patient PATCH success',
|
|
125
|
+
}),
|
|
126
|
+
tslib_1.__param(0, rest_1.param.path.number('id')),
|
|
127
|
+
tslib_1.__param(1, (0, rest_1.requestBody)({
|
|
128
|
+
content: {
|
|
129
|
+
'application/json': {
|
|
130
|
+
schema: (0, rest_1.getModelSchemaRef)(models_1.Patient, { partial: true }),
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
})),
|
|
134
|
+
tslib_1.__metadata("design:type", Function),
|
|
135
|
+
tslib_1.__metadata("design:paramtypes", [Number, models_1.Patient]),
|
|
136
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
137
|
+
], PatientController.prototype, "updateById", null);
|
|
138
|
+
tslib_1.__decorate([
|
|
139
|
+
(0, rest_1.put)('/patients/{id}'),
|
|
140
|
+
(0, rest_1.response)(204, {
|
|
141
|
+
description: 'Patient PUT success',
|
|
142
|
+
}),
|
|
143
|
+
tslib_1.__param(0, rest_1.param.path.number('id')),
|
|
144
|
+
tslib_1.__param(1, (0, rest_1.requestBody)()),
|
|
145
|
+
tslib_1.__metadata("design:type", Function),
|
|
146
|
+
tslib_1.__metadata("design:paramtypes", [Number, models_1.Patient]),
|
|
147
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
148
|
+
], PatientController.prototype, "replaceById", null);
|
|
149
|
+
tslib_1.__decorate([
|
|
150
|
+
(0, rest_1.del)('/patients/{id}'),
|
|
151
|
+
(0, rest_1.response)(204, {
|
|
152
|
+
description: 'Patient DELETE success',
|
|
153
|
+
}),
|
|
154
|
+
tslib_1.__param(0, rest_1.param.path.number('id')),
|
|
155
|
+
tslib_1.__metadata("design:type", Function),
|
|
156
|
+
tslib_1.__metadata("design:paramtypes", [Number]),
|
|
157
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
158
|
+
], PatientController.prototype, "deleteById", null);
|
|
159
|
+
PatientController = tslib_1.__decorate([
|
|
160
|
+
tslib_1.__param(0, (0, repository_1.repository)(repositories_1.PatientRepository)),
|
|
161
|
+
tslib_1.__metadata("design:paramtypes", [repositories_1.PatientRepository])
|
|
162
|
+
], PatientController);
|
|
163
|
+
exports.PatientController = PatientController;
|
|
164
|
+
//# sourceMappingURL=patient.controller.js.map
|
|
165
|
+
//# sourceMappingURL=/Users/dianalau/code/loopback/loopback-next/extensions/sequelize/dist/__tests__/fixtures/controllers/patient.controller.js.map
|