@loopback/sequelize 0.5.2 → 0.5.3

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 (54) hide show
  1. package/dist/sequelize/sequelize.repository.base.d.ts +19 -4
  2. package/dist/sequelize/sequelize.repository.base.js +10 -1
  3. package/dist/sequelize/sequelize.repository.base.js.map +1 -1
  4. package/package.json +12 -11
  5. package/src/sequelize/sequelize.repository.base.ts +37 -8
  6. package/dist/.sandbox/23319CTsyje/application.js +0 -15
  7. package/dist/.sandbox/23319CTsyje/controllers/book-category.controller.js +0 -41
  8. package/dist/.sandbox/23319CTsyje/controllers/book.controller.js +0 -210
  9. package/dist/.sandbox/23319CTsyje/controllers/category.controller.js +0 -198
  10. package/dist/.sandbox/23319CTsyje/controllers/developer.controller.js +0 -177
  11. package/dist/.sandbox/23319CTsyje/controllers/doctor-patient.controller.js +0 -112
  12. package/dist/.sandbox/23319CTsyje/controllers/doctor.controller.js +0 -177
  13. package/dist/.sandbox/23319CTsyje/controllers/index.js +0 -23
  14. package/dist/.sandbox/23319CTsyje/controllers/patient.controller.js +0 -165
  15. package/dist/.sandbox/23319CTsyje/controllers/product.controller.js +0 -177
  16. package/dist/.sandbox/23319CTsyje/controllers/programming-languange.controller.js +0 -204
  17. package/dist/.sandbox/23319CTsyje/controllers/task.controller.js +0 -210
  18. package/dist/.sandbox/23319CTsyje/controllers/test.controller.base.js +0 -27
  19. package/dist/.sandbox/23319CTsyje/controllers/todo-list-todo.controller.js +0 -113
  20. package/dist/.sandbox/23319CTsyje/controllers/todo-list.controller.js +0 -177
  21. package/dist/.sandbox/23319CTsyje/controllers/todo-todo-list.controller.js +0 -41
  22. package/dist/.sandbox/23319CTsyje/controllers/todo.controller.js +0 -177
  23. package/dist/.sandbox/23319CTsyje/controllers/transaction.controller.js +0 -157
  24. package/dist/.sandbox/23319CTsyje/controllers/user-todo-list.controller.js +0 -113
  25. package/dist/.sandbox/23319CTsyje/controllers/user.controller.js +0 -210
  26. package/dist/.sandbox/23319CTsyje/datasources/config.js +0 -65
  27. package/dist/.sandbox/23319CTsyje/datasources/primary.datasource.js +0 -28
  28. package/dist/.sandbox/23319CTsyje/datasources/secondary.datasource.js +0 -28
  29. package/dist/.sandbox/23319CTsyje/models/appointment.model.js +0 -37
  30. package/dist/.sandbox/23319CTsyje/models/book.model.js +0 -48
  31. package/dist/.sandbox/23319CTsyje/models/category.model.js +0 -32
  32. package/dist/.sandbox/23319CTsyje/models/developer.model.js +0 -47
  33. package/dist/.sandbox/23319CTsyje/models/doctor.model.js +0 -44
  34. package/dist/.sandbox/23319CTsyje/models/index.js +0 -17
  35. package/dist/.sandbox/23319CTsyje/models/patient.model.js +0 -32
  36. package/dist/.sandbox/23319CTsyje/models/product.model.js +0 -41
  37. package/dist/.sandbox/23319CTsyje/models/programming-language.model.js +0 -39
  38. package/dist/.sandbox/23319CTsyje/models/task.model.js +0 -74
  39. package/dist/.sandbox/23319CTsyje/models/todo-list.model.js +0 -45
  40. package/dist/.sandbox/23319CTsyje/models/todo.model.js +0 -44
  41. package/dist/.sandbox/23319CTsyje/models/user.model.js +0 -92
  42. package/dist/.sandbox/23319CTsyje/repositories/appointment.repository.js +0 -20
  43. package/dist/.sandbox/23319CTsyje/repositories/book.repository.js +0 -25
  44. package/dist/.sandbox/23319CTsyje/repositories/category.repository.js +0 -20
  45. package/dist/.sandbox/23319CTsyje/repositories/developer.repository.js +0 -25
  46. package/dist/.sandbox/23319CTsyje/repositories/doctor.repository.js +0 -27
  47. package/dist/.sandbox/23319CTsyje/repositories/index.js +0 -17
  48. package/dist/.sandbox/23319CTsyje/repositories/patient.repository.js +0 -20
  49. package/dist/.sandbox/23319CTsyje/repositories/product.repository.js +0 -20
  50. package/dist/.sandbox/23319CTsyje/repositories/programming-language.repository.js +0 -20
  51. package/dist/.sandbox/23319CTsyje/repositories/task.repository.js +0 -26
  52. package/dist/.sandbox/23319CTsyje/repositories/todo-list.repository.js +0 -25
  53. package/dist/.sandbox/23319CTsyje/repositories/todo.repository.js +0 -25
  54. package/dist/.sandbox/23319CTsyje/repositories/user.repository.js +0 -25
@@ -1,177 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TodoController = 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 TodoController = class TodoController extends test_controller_base_1.TestControllerBase {
11
- constructor(todoRepository) {
12
- super(todoRepository);
13
- this.todoRepository = todoRepository;
14
- }
15
- async create(todo) {
16
- return this.todoRepository.create(todo);
17
- }
18
- async count(where) {
19
- return this.todoRepository.count(where);
20
- }
21
- async find(filter) {
22
- return this.todoRepository.find(filter);
23
- }
24
- async updateAll(todo, where) {
25
- return this.todoRepository.updateAll(todo, where);
26
- }
27
- async findById(id, filter) {
28
- return this.todoRepository.findById(id, filter);
29
- }
30
- async updateById(id, todo) {
31
- await this.todoRepository.updateById(id, todo);
32
- }
33
- async replaceById(id, todo) {
34
- await this.todoRepository.replaceById(id, todo);
35
- }
36
- async deleteById(id) {
37
- await this.todoRepository.deleteById(id);
38
- }
39
- async syncSequelizeModel() {
40
- await this.beforeEach();
41
- }
42
- };
43
- exports.TodoController = TodoController;
44
- tslib_1.__decorate([
45
- (0, rest_1.post)('/todos'),
46
- (0, rest_1.response)(200, {
47
- description: 'Todo model instance',
48
- content: { 'application/json': { schema: (0, rest_1.getModelSchemaRef)(models_1.Todo) } },
49
- }),
50
- tslib_1.__param(0, (0, rest_1.requestBody)({
51
- content: {
52
- 'application/json': {
53
- schema: (0, rest_1.getModelSchemaRef)(models_1.Todo, {
54
- title: 'NewTodo',
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
- ], TodoController.prototype, "create", null);
64
- tslib_1.__decorate([
65
- (0, rest_1.get)('/todos/count'),
66
- (0, rest_1.response)(200, {
67
- description: 'Todo model count',
68
- content: { 'application/json': { schema: repository_1.CountSchema } },
69
- }),
70
- tslib_1.__param(0, rest_1.param.where(models_1.Todo)),
71
- tslib_1.__metadata("design:type", Function),
72
- tslib_1.__metadata("design:paramtypes", [Object]),
73
- tslib_1.__metadata("design:returntype", Promise)
74
- ], TodoController.prototype, "count", null);
75
- tslib_1.__decorate([
76
- (0, rest_1.get)('/todos'),
77
- (0, rest_1.response)(200, {
78
- description: 'Array of Todo model instances',
79
- content: {
80
- 'application/json': {
81
- schema: {
82
- type: 'array',
83
- items: (0, rest_1.getModelSchemaRef)(models_1.Todo, { includeRelations: true }),
84
- },
85
- },
86
- },
87
- }),
88
- tslib_1.__param(0, rest_1.param.filter(models_1.Todo)),
89
- tslib_1.__metadata("design:type", Function),
90
- tslib_1.__metadata("design:paramtypes", [Object]),
91
- tslib_1.__metadata("design:returntype", Promise)
92
- ], TodoController.prototype, "find", null);
93
- tslib_1.__decorate([
94
- (0, rest_1.patch)('/todos'),
95
- (0, rest_1.response)(200, {
96
- description: 'Todo PATCH success count',
97
- content: { 'application/json': { schema: repository_1.CountSchema } },
98
- }),
99
- tslib_1.__param(0, (0, rest_1.requestBody)({
100
- content: {
101
- 'application/json': {
102
- schema: (0, rest_1.getModelSchemaRef)(models_1.Todo, { partial: true }),
103
- },
104
- },
105
- })),
106
- tslib_1.__param(1, rest_1.param.where(models_1.Todo)),
107
- tslib_1.__metadata("design:type", Function),
108
- tslib_1.__metadata("design:paramtypes", [models_1.Todo, Object]),
109
- tslib_1.__metadata("design:returntype", Promise)
110
- ], TodoController.prototype, "updateAll", null);
111
- tslib_1.__decorate([
112
- (0, rest_1.get)('/todos/{id}'),
113
- (0, rest_1.response)(200, {
114
- description: 'Todo model instance',
115
- content: {
116
- 'application/json': {
117
- schema: (0, rest_1.getModelSchemaRef)(models_1.Todo, { includeRelations: true }),
118
- },
119
- },
120
- }),
121
- tslib_1.__param(0, rest_1.param.path.number('id')),
122
- tslib_1.__param(1, rest_1.param.filter(models_1.Todo, { exclude: 'where' })),
123
- tslib_1.__metadata("design:type", Function),
124
- tslib_1.__metadata("design:paramtypes", [Number, Object]),
125
- tslib_1.__metadata("design:returntype", Promise)
126
- ], TodoController.prototype, "findById", null);
127
- tslib_1.__decorate([
128
- (0, rest_1.patch)('/todos/{id}'),
129
- (0, rest_1.response)(204, {
130
- description: 'Todo PATCH success',
131
- }),
132
- tslib_1.__param(0, rest_1.param.path.number('id')),
133
- tslib_1.__param(1, (0, rest_1.requestBody)({
134
- content: {
135
- 'application/json': {
136
- schema: (0, rest_1.getModelSchemaRef)(models_1.Todo, { partial: true }),
137
- },
138
- },
139
- })),
140
- tslib_1.__metadata("design:type", Function),
141
- tslib_1.__metadata("design:paramtypes", [Number, models_1.Todo]),
142
- tslib_1.__metadata("design:returntype", Promise)
143
- ], TodoController.prototype, "updateById", null);
144
- tslib_1.__decorate([
145
- (0, rest_1.put)('/todos/{id}'),
146
- (0, rest_1.response)(204, {
147
- description: 'Todo PUT success',
148
- }),
149
- tslib_1.__param(0, rest_1.param.path.number('id')),
150
- tslib_1.__param(1, (0, rest_1.requestBody)()),
151
- tslib_1.__metadata("design:type", Function),
152
- tslib_1.__metadata("design:paramtypes", [Number, models_1.Todo]),
153
- tslib_1.__metadata("design:returntype", Promise)
154
- ], TodoController.prototype, "replaceById", null);
155
- tslib_1.__decorate([
156
- (0, rest_1.del)('/todos/{id}'),
157
- (0, rest_1.response)(204, {
158
- description: 'Todo DELETE success',
159
- }),
160
- tslib_1.__param(0, rest_1.param.path.number('id')),
161
- tslib_1.__metadata("design:type", Function),
162
- tslib_1.__metadata("design:paramtypes", [Number]),
163
- tslib_1.__metadata("design:returntype", Promise)
164
- ], TodoController.prototype, "deleteById", null);
165
- tslib_1.__decorate([
166
- (0, rest_1.get)('/todos/sync-sequelize-model'),
167
- (0, rest_1.response)(200),
168
- tslib_1.__metadata("design:type", Function),
169
- tslib_1.__metadata("design:paramtypes", []),
170
- tslib_1.__metadata("design:returntype", Promise)
171
- ], TodoController.prototype, "syncSequelizeModel", null);
172
- exports.TodoController = TodoController = tslib_1.__decorate([
173
- tslib_1.__param(0, (0, repository_1.repository)(repositories_1.TodoRepository)),
174
- tslib_1.__metadata("design:paramtypes", [repositories_1.TodoRepository])
175
- ], TodoController);
176
- //# sourceMappingURL=todo.controller.js.map
177
- //# sourceMappingURL=/Users/dianalau/code/loopback/loopback-next/extensions/sequelize/dist/__tests__/fixtures/controllers/todo.controller.js.map
@@ -1,157 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TransactionController = 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 types_1 = require("./../../../types");
10
- const test_controller_base_1 = require("./test.controller.base");
11
- let TransactionController = class TransactionController extends test_controller_base_1.TestControllerBase {
12
- constructor(todoListRepository, productRepository) {
13
- super(todoListRepository, productRepository);
14
- this.todoListRepository = todoListRepository;
15
- this.productRepository = productRepository;
16
- }
17
- // create todo-list entry using transaction
18
- async ensureTransactionCommit(todoList) {
19
- const tx = await this.todoListRepository.beginTransaction({
20
- isolationLevel: types_1.Transaction.ISOLATION_LEVELS.SERIALIZABLE,
21
- });
22
- try {
23
- const created = await this.todoListRepository.create(todoList, {
24
- transaction: tx,
25
- });
26
- await tx.commit();
27
- return created;
28
- }
29
- catch (err) {
30
- await tx.rollback();
31
- throw err;
32
- }
33
- }
34
- // create todo-list entry using transaction but rollback
35
- async ensureRollback(todoList) {
36
- const tx = await this.todoListRepository.beginTransaction({
37
- isolationLevel: types_1.Transaction.ISOLATION_LEVELS.READ_COMMITTED,
38
- });
39
- const created = await this.todoListRepository.create(todoList, {
40
- transaction: tx,
41
- });
42
- await tx.rollback();
43
- // In real applications if you're rolling back. Don't return created entities to user
44
- // For test cases it's required here. (to get the id)
45
- return created;
46
- }
47
- // create todo-list entry using transaction but don't commit or rollback
48
- async ensureIsolatedTransaction(todoList) {
49
- const tx = await this.todoListRepository.beginTransaction({
50
- isolationLevel: types_1.Transaction.ISOLATION_LEVELS.READ_COMMITTED,
51
- });
52
- const created = await this.todoListRepository.create(todoList, {
53
- transaction: tx,
54
- });
55
- let err = {};
56
- // reading before commit in READ_COMMITED level should not find the entity
57
- const findBeforeCommit = await this.todoListRepository
58
- .findById(created.id)
59
- .catch(e => (err = e));
60
- await tx.commit();
61
- // throwing it after commit to avoid deadlocks
62
- if (err) {
63
- throw err;
64
- }
65
- return findBeforeCommit;
66
- }
67
- async ensureLocalTransactions() {
68
- // "Todo List" model is from Primary Datasource
69
- // and "AnyObject" model is from Secondary Datasource
70
- // this test case is to ensure transaction created on
71
- // one datasource can't be used in another
72
- const tx = await this.todoListRepository.beginTransaction({
73
- isolationLevel: types_1.Transaction.ISOLATION_LEVELS.SERIALIZABLE,
74
- });
75
- let err = null;
76
- try {
77
- await this.productRepository.create({
78
- name: 'phone',
79
- price: 5000,
80
- }, {
81
- transaction: tx,
82
- });
83
- }
84
- catch (e) {
85
- err = e;
86
- }
87
- await tx.commit();
88
- if (err) {
89
- throw new rest_1.HttpErrors[406](err.message);
90
- }
91
- // Won't reach till here if test passes
92
- throw new rest_1.HttpErrors[406]('Product created with non-local transaction.');
93
- }
94
- };
95
- exports.TransactionController = TransactionController;
96
- tslib_1.__decorate([
97
- (0, rest_1.post)('/transactions/todo-lists/commit'),
98
- tslib_1.__param(0, (0, rest_1.requestBody)({
99
- content: {
100
- 'application/json': {
101
- schema: (0, rest_1.getModelSchemaRef)(models_1.TodoList, {
102
- title: 'NewTodoList',
103
- exclude: ['id'],
104
- }),
105
- },
106
- },
107
- })),
108
- tslib_1.__metadata("design:type", Function),
109
- tslib_1.__metadata("design:paramtypes", [Object]),
110
- tslib_1.__metadata("design:returntype", Promise)
111
- ], TransactionController.prototype, "ensureTransactionCommit", null);
112
- tslib_1.__decorate([
113
- (0, rest_1.post)('/transactions/todo-lists/rollback'),
114
- tslib_1.__param(0, (0, rest_1.requestBody)({
115
- content: {
116
- 'application/json': {
117
- schema: (0, rest_1.getModelSchemaRef)(models_1.TodoList, {
118
- title: 'NewTodoList',
119
- exclude: ['id'],
120
- }),
121
- },
122
- },
123
- })),
124
- tslib_1.__metadata("design:type", Function),
125
- tslib_1.__metadata("design:paramtypes", [Object]),
126
- tslib_1.__metadata("design:returntype", Promise)
127
- ], TransactionController.prototype, "ensureRollback", null);
128
- tslib_1.__decorate([
129
- (0, rest_1.post)('/transactions/todo-lists/isolation/read_commited'),
130
- tslib_1.__param(0, (0, rest_1.requestBody)({
131
- content: {
132
- 'application/json': {
133
- schema: (0, rest_1.getModelSchemaRef)(models_1.TodoList, {
134
- title: 'NewTodoList',
135
- exclude: ['id'],
136
- }),
137
- },
138
- },
139
- })),
140
- tslib_1.__metadata("design:type", Function),
141
- tslib_1.__metadata("design:paramtypes", [Object]),
142
- tslib_1.__metadata("design:returntype", Promise)
143
- ], TransactionController.prototype, "ensureIsolatedTransaction", null);
144
- tslib_1.__decorate([
145
- (0, rest_1.get)('/transactions/ensure-local'),
146
- tslib_1.__metadata("design:type", Function),
147
- tslib_1.__metadata("design:paramtypes", []),
148
- tslib_1.__metadata("design:returntype", Promise)
149
- ], TransactionController.prototype, "ensureLocalTransactions", null);
150
- exports.TransactionController = TransactionController = tslib_1.__decorate([
151
- tslib_1.__param(0, (0, repository_1.repository)(repositories_1.TodoListRepository)),
152
- tslib_1.__param(1, (0, repository_1.repository)(repositories_1.ProductRepository)),
153
- tslib_1.__metadata("design:paramtypes", [repositories_1.TodoListRepository,
154
- repositories_1.ProductRepository])
155
- ], TransactionController);
156
- //# sourceMappingURL=transaction.controller.js.map
157
- //# sourceMappingURL=/Users/dianalau/code/loopback/loopback-next/extensions/sequelize/dist/__tests__/fixtures/controllers/transaction.controller.js.map
@@ -1,113 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UserTodoListController = 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 UserTodoListController = class UserTodoListController {
10
- constructor(userRepository) {
11
- this.userRepository = userRepository;
12
- }
13
- async get(id, filter) {
14
- return this.userRepository.todoList(id).get(filter);
15
- }
16
- async create(id, todoList) {
17
- return this.userRepository.todoList(id).create(todoList);
18
- }
19
- async patch(id, todoList, where) {
20
- return this.userRepository.todoList(id).patch(todoList, where);
21
- }
22
- async delete(id, where) {
23
- return this.userRepository.todoList(id).delete(where);
24
- }
25
- };
26
- exports.UserTodoListController = UserTodoListController;
27
- tslib_1.__decorate([
28
- (0, rest_1.get)('/users/{id}/todo-list', {
29
- responses: {
30
- '200': {
31
- description: 'User has one TodoList',
32
- content: {
33
- 'application/json': {
34
- schema: (0, rest_1.getModelSchemaRef)(models_1.TodoList),
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
- ], UserTodoListController.prototype, "get", null);
46
- tslib_1.__decorate([
47
- (0, rest_1.post)('/users/{id}/todo-list', {
48
- responses: {
49
- '200': {
50
- description: 'User model instance',
51
- content: { 'application/json': { schema: (0, rest_1.getModelSchemaRef)(models_1.TodoList) } },
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.TodoList, {
60
- title: 'NewTodoListInUser',
61
- exclude: ['id'],
62
- optional: ['user'],
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
- ], UserTodoListController.prototype, "create", null);
71
- tslib_1.__decorate([
72
- (0, rest_1.patch)('/users/{id}/todo-list', {
73
- responses: {
74
- '200': {
75
- description: 'User.TodoList 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.TodoList, { partial: true }),
85
- },
86
- },
87
- })),
88
- tslib_1.__param(2, rest_1.param.query.object('where', (0, rest_1.getWhereSchemaFor)(models_1.TodoList))),
89
- tslib_1.__metadata("design:type", Function),
90
- tslib_1.__metadata("design:paramtypes", [Number, Object, Object]),
91
- tslib_1.__metadata("design:returntype", Promise)
92
- ], UserTodoListController.prototype, "patch", null);
93
- tslib_1.__decorate([
94
- (0, rest_1.del)('/users/{id}/todo-list', {
95
- responses: {
96
- '200': {
97
- description: 'User.TodoList 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.TodoList))),
104
- tslib_1.__metadata("design:type", Function),
105
- tslib_1.__metadata("design:paramtypes", [Number, Object]),
106
- tslib_1.__metadata("design:returntype", Promise)
107
- ], UserTodoListController.prototype, "delete", null);
108
- exports.UserTodoListController = UserTodoListController = tslib_1.__decorate([
109
- tslib_1.__param(0, (0, repository_1.repository)(repositories_1.UserRepository)),
110
- tslib_1.__metadata("design:paramtypes", [repositories_1.UserRepository])
111
- ], UserTodoListController);
112
- //# sourceMappingURL=user-todo-list.controller.js.map
113
- //# sourceMappingURL=/Users/dianalau/code/loopback/loopback-next/extensions/sequelize/dist/__tests__/fixtures/controllers/user-todo-list.controller.js.map
@@ -1,210 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UserController = 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 UserController = class UserController extends test_controller_base_1.TestControllerBase {
11
- constructor(userRepository) {
12
- super(userRepository);
13
- this.userRepository = userRepository;
14
- }
15
- async create(user) {
16
- return this.userRepository.create(user);
17
- }
18
- async createAll(users) {
19
- return this.userRepository.createAll(users);
20
- }
21
- async count(where) {
22
- return this.userRepository.count(where);
23
- }
24
- async find(filter) {
25
- return this.userRepository.find(filter);
26
- }
27
- async updateAll(user, where) {
28
- return this.userRepository.updateAll(user, where);
29
- }
30
- async findById(id, filter) {
31
- return this.userRepository.findById(id, filter);
32
- }
33
- async updateById(id, user) {
34
- await this.userRepository.updateById(id, user);
35
- }
36
- async replaceById(id, user) {
37
- await this.userRepository.replaceById(id, user);
38
- }
39
- async deleteById(id) {
40
- await this.userRepository.deleteById(id);
41
- }
42
- async syncSequelizeModel() {
43
- await this.beforeEach();
44
- }
45
- };
46
- exports.UserController = UserController;
47
- tslib_1.__decorate([
48
- (0, rest_1.post)('/users'),
49
- (0, rest_1.response)(200, {
50
- description: 'User model instance',
51
- content: { 'application/json': { schema: (0, rest_1.getModelSchemaRef)(models_1.User) } },
52
- }),
53
- tslib_1.__param(0, (0, rest_1.requestBody)({
54
- content: {
55
- 'application/json': {
56
- schema: (0, rest_1.getModelSchemaRef)(models_1.User, {
57
- title: 'NewUser',
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
- ], UserController.prototype, "create", null);
67
- tslib_1.__decorate([
68
- (0, rest_1.post)('/users-bulk'),
69
- (0, rest_1.response)(200, {
70
- description: 'User model instances',
71
- content: {
72
- 'application/json': {
73
- schema: {
74
- type: 'array',
75
- items: (0, rest_1.getModelSchemaRef)(models_1.User),
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.User, {
86
- title: 'NewUser',
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
- ], UserController.prototype, "createAll", null);
97
- tslib_1.__decorate([
98
- (0, rest_1.get)('/users/count'),
99
- (0, rest_1.response)(200, {
100
- description: 'User model count',
101
- content: { 'application/json': { schema: repository_1.CountSchema } },
102
- }),
103
- tslib_1.__param(0, rest_1.param.where(models_1.User)),
104
- tslib_1.__metadata("design:type", Function),
105
- tslib_1.__metadata("design:paramtypes", [Object]),
106
- tslib_1.__metadata("design:returntype", Promise)
107
- ], UserController.prototype, "count", null);
108
- tslib_1.__decorate([
109
- (0, rest_1.get)('/users'),
110
- (0, rest_1.response)(200, {
111
- description: 'Array of User model instances',
112
- content: {
113
- 'application/json': {
114
- schema: {
115
- type: 'array',
116
- items: (0, rest_1.getModelSchemaRef)(models_1.User, { includeRelations: true }),
117
- },
118
- },
119
- },
120
- }),
121
- tslib_1.__param(0, rest_1.param.filter(models_1.User)),
122
- tslib_1.__metadata("design:type", Function),
123
- tslib_1.__metadata("design:paramtypes", [Object]),
124
- tslib_1.__metadata("design:returntype", Promise)
125
- ], UserController.prototype, "find", null);
126
- tslib_1.__decorate([
127
- (0, rest_1.patch)('/users'),
128
- (0, rest_1.response)(200, {
129
- description: 'User 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.User, { partial: true }),
136
- },
137
- },
138
- })),
139
- tslib_1.__param(1, rest_1.param.where(models_1.User)),
140
- tslib_1.__metadata("design:type", Function),
141
- tslib_1.__metadata("design:paramtypes", [models_1.User, Object]),
142
- tslib_1.__metadata("design:returntype", Promise)
143
- ], UserController.prototype, "updateAll", null);
144
- tslib_1.__decorate([
145
- (0, rest_1.get)('/users/{id}'),
146
- (0, rest_1.response)(200, {
147
- description: 'User model instance',
148
- content: {
149
- 'application/json': {
150
- schema: (0, rest_1.getModelSchemaRef)(models_1.User, { 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.User, { 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
- ], UserController.prototype, "findById", null);
160
- tslib_1.__decorate([
161
- (0, rest_1.patch)('/users/{id}'),
162
- (0, rest_1.response)(204, {
163
- description: 'User 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.User, { partial: true }),
170
- },
171
- },
172
- })),
173
- tslib_1.__metadata("design:type", Function),
174
- tslib_1.__metadata("design:paramtypes", [Number, models_1.User]),
175
- tslib_1.__metadata("design:returntype", Promise)
176
- ], UserController.prototype, "updateById", null);
177
- tslib_1.__decorate([
178
- (0, rest_1.put)('/users/{id}'),
179
- (0, rest_1.response)(204, {
180
- description: 'User 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.User]),
186
- tslib_1.__metadata("design:returntype", Promise)
187
- ], UserController.prototype, "replaceById", null);
188
- tslib_1.__decorate([
189
- (0, rest_1.del)('/users/{id}'),
190
- (0, rest_1.response)(204, {
191
- description: 'User 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
- ], UserController.prototype, "deleteById", null);
198
- tslib_1.__decorate([
199
- (0, rest_1.get)('/users/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
- ], UserController.prototype, "syncSequelizeModel", null);
205
- exports.UserController = UserController = tslib_1.__decorate([
206
- tslib_1.__param(0, (0, repository_1.repository)(repositories_1.UserRepository)),
207
- tslib_1.__metadata("design:paramtypes", [repositories_1.UserRepository])
208
- ], UserController);
209
- //# sourceMappingURL=user.controller.js.map
210
- //# sourceMappingURL=/Users/dianalau/code/loopback/loopback-next/extensions/sequelize/dist/__tests__/fixtures/controllers/user.controller.js.map