@loopback/sequelize 0.5.1 → 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 (56) hide show
  1. package/dist/component.js +2 -1
  2. package/dist/component.js.map +1 -1
  3. package/dist/sequelize/sequelize.repository.base.d.ts +19 -4
  4. package/dist/sequelize/sequelize.repository.base.js +10 -1
  5. package/dist/sequelize/sequelize.repository.base.js.map +1 -1
  6. package/package.json +15 -14
  7. package/src/sequelize/sequelize.repository.base.ts +37 -8
  8. package/dist/.sandbox/52958FChNfK/application.js +0 -15
  9. package/dist/.sandbox/52958FChNfK/controllers/book-category.controller.js +0 -40
  10. package/dist/.sandbox/52958FChNfK/controllers/book.controller.js +0 -209
  11. package/dist/.sandbox/52958FChNfK/controllers/category.controller.js +0 -197
  12. package/dist/.sandbox/52958FChNfK/controllers/developer.controller.js +0 -176
  13. package/dist/.sandbox/52958FChNfK/controllers/doctor-patient.controller.js +0 -111
  14. package/dist/.sandbox/52958FChNfK/controllers/doctor.controller.js +0 -176
  15. package/dist/.sandbox/52958FChNfK/controllers/index.js +0 -23
  16. package/dist/.sandbox/52958FChNfK/controllers/patient.controller.js +0 -164
  17. package/dist/.sandbox/52958FChNfK/controllers/product.controller.js +0 -176
  18. package/dist/.sandbox/52958FChNfK/controllers/programming-languange.controller.js +0 -203
  19. package/dist/.sandbox/52958FChNfK/controllers/task.controller.js +0 -209
  20. package/dist/.sandbox/52958FChNfK/controllers/test.controller.base.js +0 -27
  21. package/dist/.sandbox/52958FChNfK/controllers/todo-list-todo.controller.js +0 -112
  22. package/dist/.sandbox/52958FChNfK/controllers/todo-list.controller.js +0 -176
  23. package/dist/.sandbox/52958FChNfK/controllers/todo-todo-list.controller.js +0 -40
  24. package/dist/.sandbox/52958FChNfK/controllers/todo.controller.js +0 -176
  25. package/dist/.sandbox/52958FChNfK/controllers/transaction.controller.js +0 -156
  26. package/dist/.sandbox/52958FChNfK/controllers/user-todo-list.controller.js +0 -112
  27. package/dist/.sandbox/52958FChNfK/controllers/user.controller.js +0 -209
  28. package/dist/.sandbox/52958FChNfK/datasources/config.js +0 -65
  29. package/dist/.sandbox/52958FChNfK/datasources/primary.datasource.js +0 -27
  30. package/dist/.sandbox/52958FChNfK/datasources/secondary.datasource.js +0 -27
  31. package/dist/.sandbox/52958FChNfK/models/appointment.model.js +0 -36
  32. package/dist/.sandbox/52958FChNfK/models/book.model.js +0 -47
  33. package/dist/.sandbox/52958FChNfK/models/category.model.js +0 -31
  34. package/dist/.sandbox/52958FChNfK/models/developer.model.js +0 -46
  35. package/dist/.sandbox/52958FChNfK/models/doctor.model.js +0 -43
  36. package/dist/.sandbox/52958FChNfK/models/index.js +0 -17
  37. package/dist/.sandbox/52958FChNfK/models/patient.model.js +0 -31
  38. package/dist/.sandbox/52958FChNfK/models/product.model.js +0 -40
  39. package/dist/.sandbox/52958FChNfK/models/programming-language.model.js +0 -38
  40. package/dist/.sandbox/52958FChNfK/models/task.model.js +0 -73
  41. package/dist/.sandbox/52958FChNfK/models/todo-list.model.js +0 -44
  42. package/dist/.sandbox/52958FChNfK/models/todo.model.js +0 -43
  43. package/dist/.sandbox/52958FChNfK/models/user.model.js +0 -90
  44. package/dist/.sandbox/52958FChNfK/repositories/appointment.repository.js +0 -19
  45. package/dist/.sandbox/52958FChNfK/repositories/book.repository.js +0 -24
  46. package/dist/.sandbox/52958FChNfK/repositories/category.repository.js +0 -19
  47. package/dist/.sandbox/52958FChNfK/repositories/developer.repository.js +0 -24
  48. package/dist/.sandbox/52958FChNfK/repositories/doctor.repository.js +0 -26
  49. package/dist/.sandbox/52958FChNfK/repositories/index.js +0 -17
  50. package/dist/.sandbox/52958FChNfK/repositories/patient.repository.js +0 -19
  51. package/dist/.sandbox/52958FChNfK/repositories/product.repository.js +0 -19
  52. package/dist/.sandbox/52958FChNfK/repositories/programming-language.repository.js +0 -19
  53. package/dist/.sandbox/52958FChNfK/repositories/task.repository.js +0 -25
  54. package/dist/.sandbox/52958FChNfK/repositories/todo-list.repository.js +0 -24
  55. package/dist/.sandbox/52958FChNfK/repositories/todo.repository.js +0 -24
  56. package/dist/.sandbox/52958FChNfK/repositories/user.repository.js +0 -24
@@ -1,176 +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 = exports.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
- tslib_1.__decorate([
44
- (0, rest_1.post)('/todos'),
45
- (0, rest_1.response)(200, {
46
- description: 'Todo model instance',
47
- content: { 'application/json': { schema: (0, rest_1.getModelSchemaRef)(models_1.Todo) } },
48
- }),
49
- tslib_1.__param(0, (0, rest_1.requestBody)({
50
- content: {
51
- 'application/json': {
52
- schema: (0, rest_1.getModelSchemaRef)(models_1.Todo, {
53
- title: 'NewTodo',
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
- ], TodoController.prototype, "create", null);
63
- tslib_1.__decorate([
64
- (0, rest_1.get)('/todos/count'),
65
- (0, rest_1.response)(200, {
66
- description: 'Todo model count',
67
- content: { 'application/json': { schema: repository_1.CountSchema } },
68
- }),
69
- tslib_1.__param(0, rest_1.param.where(models_1.Todo)),
70
- tslib_1.__metadata("design:type", Function),
71
- tslib_1.__metadata("design:paramtypes", [Object]),
72
- tslib_1.__metadata("design:returntype", Promise)
73
- ], TodoController.prototype, "count", null);
74
- tslib_1.__decorate([
75
- (0, rest_1.get)('/todos'),
76
- (0, rest_1.response)(200, {
77
- description: 'Array of Todo model instances',
78
- content: {
79
- 'application/json': {
80
- schema: {
81
- type: 'array',
82
- items: (0, rest_1.getModelSchemaRef)(models_1.Todo, { includeRelations: true }),
83
- },
84
- },
85
- },
86
- }),
87
- tslib_1.__param(0, rest_1.param.filter(models_1.Todo)),
88
- tslib_1.__metadata("design:type", Function),
89
- tslib_1.__metadata("design:paramtypes", [Object]),
90
- tslib_1.__metadata("design:returntype", Promise)
91
- ], TodoController.prototype, "find", null);
92
- tslib_1.__decorate([
93
- (0, rest_1.patch)('/todos'),
94
- (0, rest_1.response)(200, {
95
- description: 'Todo 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.Todo, { partial: true }),
102
- },
103
- },
104
- })),
105
- tslib_1.__param(1, rest_1.param.where(models_1.Todo)),
106
- tslib_1.__metadata("design:type", Function),
107
- tslib_1.__metadata("design:paramtypes", [models_1.Todo, Object]),
108
- tslib_1.__metadata("design:returntype", Promise)
109
- ], TodoController.prototype, "updateAll", null);
110
- tslib_1.__decorate([
111
- (0, rest_1.get)('/todos/{id}'),
112
- (0, rest_1.response)(200, {
113
- description: 'Todo model instance',
114
- content: {
115
- 'application/json': {
116
- schema: (0, rest_1.getModelSchemaRef)(models_1.Todo, { 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.Todo, { 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
- ], TodoController.prototype, "findById", null);
126
- tslib_1.__decorate([
127
- (0, rest_1.patch)('/todos/{id}'),
128
- (0, rest_1.response)(204, {
129
- description: 'Todo 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.Todo, { partial: true }),
136
- },
137
- },
138
- })),
139
- tslib_1.__metadata("design:type", Function),
140
- tslib_1.__metadata("design:paramtypes", [Number, models_1.Todo]),
141
- tslib_1.__metadata("design:returntype", Promise)
142
- ], TodoController.prototype, "updateById", null);
143
- tslib_1.__decorate([
144
- (0, rest_1.put)('/todos/{id}'),
145
- (0, rest_1.response)(204, {
146
- description: 'Todo 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.Todo]),
152
- tslib_1.__metadata("design:returntype", Promise)
153
- ], TodoController.prototype, "replaceById", null);
154
- tslib_1.__decorate([
155
- (0, rest_1.del)('/todos/{id}'),
156
- (0, rest_1.response)(204, {
157
- description: 'Todo 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
- ], TodoController.prototype, "deleteById", null);
164
- tslib_1.__decorate([
165
- (0, rest_1.get)('/todos/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
- ], TodoController.prototype, "syncSequelizeModel", null);
171
- exports.TodoController = TodoController = tslib_1.__decorate([
172
- tslib_1.__param(0, (0, repository_1.repository)(repositories_1.TodoRepository)),
173
- tslib_1.__metadata("design:paramtypes", [repositories_1.TodoRepository])
174
- ], TodoController);
175
- //# sourceMappingURL=todo.controller.js.map
176
- //# sourceMappingURL=/Users/dianalau/code/loopback/loopback-next/extensions/sequelize/dist/__tests__/fixtures/controllers/todo.controller.js.map
@@ -1,156 +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 = exports.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
- tslib_1.__decorate([
96
- (0, rest_1.post)('/transactions/todo-lists/commit'),
97
- tslib_1.__param(0, (0, rest_1.requestBody)({
98
- content: {
99
- 'application/json': {
100
- schema: (0, rest_1.getModelSchemaRef)(models_1.TodoList, {
101
- title: 'NewTodoList',
102
- exclude: ['id'],
103
- }),
104
- },
105
- },
106
- })),
107
- tslib_1.__metadata("design:type", Function),
108
- tslib_1.__metadata("design:paramtypes", [Object]),
109
- tslib_1.__metadata("design:returntype", Promise)
110
- ], TransactionController.prototype, "ensureTransactionCommit", null);
111
- tslib_1.__decorate([
112
- (0, rest_1.post)('/transactions/todo-lists/rollback'),
113
- tslib_1.__param(0, (0, rest_1.requestBody)({
114
- content: {
115
- 'application/json': {
116
- schema: (0, rest_1.getModelSchemaRef)(models_1.TodoList, {
117
- title: 'NewTodoList',
118
- exclude: ['id'],
119
- }),
120
- },
121
- },
122
- })),
123
- tslib_1.__metadata("design:type", Function),
124
- tslib_1.__metadata("design:paramtypes", [Object]),
125
- tslib_1.__metadata("design:returntype", Promise)
126
- ], TransactionController.prototype, "ensureRollback", null);
127
- tslib_1.__decorate([
128
- (0, rest_1.post)('/transactions/todo-lists/isolation/read_commited'),
129
- tslib_1.__param(0, (0, rest_1.requestBody)({
130
- content: {
131
- 'application/json': {
132
- schema: (0, rest_1.getModelSchemaRef)(models_1.TodoList, {
133
- title: 'NewTodoList',
134
- exclude: ['id'],
135
- }),
136
- },
137
- },
138
- })),
139
- tslib_1.__metadata("design:type", Function),
140
- tslib_1.__metadata("design:paramtypes", [Object]),
141
- tslib_1.__metadata("design:returntype", Promise)
142
- ], TransactionController.prototype, "ensureIsolatedTransaction", null);
143
- tslib_1.__decorate([
144
- (0, rest_1.get)('/transactions/ensure-local'),
145
- tslib_1.__metadata("design:type", Function),
146
- tslib_1.__metadata("design:paramtypes", []),
147
- tslib_1.__metadata("design:returntype", Promise)
148
- ], TransactionController.prototype, "ensureLocalTransactions", null);
149
- exports.TransactionController = TransactionController = tslib_1.__decorate([
150
- tslib_1.__param(0, (0, repository_1.repository)(repositories_1.TodoListRepository)),
151
- tslib_1.__param(1, (0, repository_1.repository)(repositories_1.ProductRepository)),
152
- tslib_1.__metadata("design:paramtypes", [repositories_1.TodoListRepository,
153
- repositories_1.ProductRepository])
154
- ], TransactionController);
155
- //# sourceMappingURL=transaction.controller.js.map
156
- //# sourceMappingURL=/Users/dianalau/code/loopback/loopback-next/extensions/sequelize/dist/__tests__/fixtures/controllers/transaction.controller.js.map
@@ -1,112 +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 = exports.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
- tslib_1.__decorate([
27
- (0, rest_1.get)('/users/{id}/todo-list', {
28
- responses: {
29
- '200': {
30
- description: 'User has one TodoList',
31
- content: {
32
- 'application/json': {
33
- schema: (0, rest_1.getModelSchemaRef)(models_1.TodoList),
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
- ], UserTodoListController.prototype, "get", null);
45
- tslib_1.__decorate([
46
- (0, rest_1.post)('/users/{id}/todo-list', {
47
- responses: {
48
- '200': {
49
- description: 'User model instance',
50
- content: { 'application/json': { schema: (0, rest_1.getModelSchemaRef)(models_1.TodoList) } },
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.TodoList, {
59
- title: 'NewTodoListInUser',
60
- exclude: ['id'],
61
- optional: ['user'],
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
- ], UserTodoListController.prototype, "create", null);
70
- tslib_1.__decorate([
71
- (0, rest_1.patch)('/users/{id}/todo-list', {
72
- responses: {
73
- '200': {
74
- description: 'User.TodoList 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.TodoList, { partial: true }),
84
- },
85
- },
86
- })),
87
- tslib_1.__param(2, rest_1.param.query.object('where', (0, rest_1.getWhereSchemaFor)(models_1.TodoList))),
88
- tslib_1.__metadata("design:type", Function),
89
- tslib_1.__metadata("design:paramtypes", [Number, Object, Object]),
90
- tslib_1.__metadata("design:returntype", Promise)
91
- ], UserTodoListController.prototype, "patch", null);
92
- tslib_1.__decorate([
93
- (0, rest_1.del)('/users/{id}/todo-list', {
94
- responses: {
95
- '200': {
96
- description: 'User.TodoList 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.TodoList))),
103
- tslib_1.__metadata("design:type", Function),
104
- tslib_1.__metadata("design:paramtypes", [Number, Object]),
105
- tslib_1.__metadata("design:returntype", Promise)
106
- ], UserTodoListController.prototype, "delete", null);
107
- exports.UserTodoListController = UserTodoListController = tslib_1.__decorate([
108
- tslib_1.__param(0, (0, repository_1.repository)(repositories_1.UserRepository)),
109
- tslib_1.__metadata("design:paramtypes", [repositories_1.UserRepository])
110
- ], UserTodoListController);
111
- //# sourceMappingURL=user-todo-list.controller.js.map
112
- //# sourceMappingURL=/Users/dianalau/code/loopback/loopback-next/extensions/sequelize/dist/__tests__/fixtures/controllers/user-todo-list.controller.js.map
@@ -1,209 +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 = exports.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
- tslib_1.__decorate([
47
- (0, rest_1.post)('/users'),
48
- (0, rest_1.response)(200, {
49
- description: 'User model instance',
50
- content: { 'application/json': { schema: (0, rest_1.getModelSchemaRef)(models_1.User) } },
51
- }),
52
- tslib_1.__param(0, (0, rest_1.requestBody)({
53
- content: {
54
- 'application/json': {
55
- schema: (0, rest_1.getModelSchemaRef)(models_1.User, {
56
- title: 'NewUser',
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
- ], UserController.prototype, "create", null);
66
- tslib_1.__decorate([
67
- (0, rest_1.post)('/users-bulk'),
68
- (0, rest_1.response)(200, {
69
- description: 'User model instances',
70
- content: {
71
- 'application/json': {
72
- schema: {
73
- type: 'array',
74
- items: (0, rest_1.getModelSchemaRef)(models_1.User),
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.User, {
85
- title: 'NewUser',
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
- ], UserController.prototype, "createAll", null);
96
- tslib_1.__decorate([
97
- (0, rest_1.get)('/users/count'),
98
- (0, rest_1.response)(200, {
99
- description: 'User model count',
100
- content: { 'application/json': { schema: repository_1.CountSchema } },
101
- }),
102
- tslib_1.__param(0, rest_1.param.where(models_1.User)),
103
- tslib_1.__metadata("design:type", Function),
104
- tslib_1.__metadata("design:paramtypes", [Object]),
105
- tslib_1.__metadata("design:returntype", Promise)
106
- ], UserController.prototype, "count", null);
107
- tslib_1.__decorate([
108
- (0, rest_1.get)('/users'),
109
- (0, rest_1.response)(200, {
110
- description: 'Array of User model instances',
111
- content: {
112
- 'application/json': {
113
- schema: {
114
- type: 'array',
115
- items: (0, rest_1.getModelSchemaRef)(models_1.User, { includeRelations: true }),
116
- },
117
- },
118
- },
119
- }),
120
- tslib_1.__param(0, rest_1.param.filter(models_1.User)),
121
- tslib_1.__metadata("design:type", Function),
122
- tslib_1.__metadata("design:paramtypes", [Object]),
123
- tslib_1.__metadata("design:returntype", Promise)
124
- ], UserController.prototype, "find", null);
125
- tslib_1.__decorate([
126
- (0, rest_1.patch)('/users'),
127
- (0, rest_1.response)(200, {
128
- description: 'User 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.User, { partial: true }),
135
- },
136
- },
137
- })),
138
- tslib_1.__param(1, rest_1.param.where(models_1.User)),
139
- tslib_1.__metadata("design:type", Function),
140
- tslib_1.__metadata("design:paramtypes", [models_1.User, Object]),
141
- tslib_1.__metadata("design:returntype", Promise)
142
- ], UserController.prototype, "updateAll", null);
143
- tslib_1.__decorate([
144
- (0, rest_1.get)('/users/{id}'),
145
- (0, rest_1.response)(200, {
146
- description: 'User model instance',
147
- content: {
148
- 'application/json': {
149
- schema: (0, rest_1.getModelSchemaRef)(models_1.User, { 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.User, { 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
- ], UserController.prototype, "findById", null);
159
- tslib_1.__decorate([
160
- (0, rest_1.patch)('/users/{id}'),
161
- (0, rest_1.response)(204, {
162
- description: 'User 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.User, { partial: true }),
169
- },
170
- },
171
- })),
172
- tslib_1.__metadata("design:type", Function),
173
- tslib_1.__metadata("design:paramtypes", [Number, models_1.User]),
174
- tslib_1.__metadata("design:returntype", Promise)
175
- ], UserController.prototype, "updateById", null);
176
- tslib_1.__decorate([
177
- (0, rest_1.put)('/users/{id}'),
178
- (0, rest_1.response)(204, {
179
- description: 'User 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.User]),
185
- tslib_1.__metadata("design:returntype", Promise)
186
- ], UserController.prototype, "replaceById", null);
187
- tslib_1.__decorate([
188
- (0, rest_1.del)('/users/{id}'),
189
- (0, rest_1.response)(204, {
190
- description: 'User 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
- ], UserController.prototype, "deleteById", null);
197
- tslib_1.__decorate([
198
- (0, rest_1.get)('/users/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
- ], UserController.prototype, "syncSequelizeModel", null);
204
- exports.UserController = UserController = tslib_1.__decorate([
205
- tslib_1.__param(0, (0, repository_1.repository)(repositories_1.UserRepository)),
206
- tslib_1.__metadata("design:paramtypes", [repositories_1.UserRepository])
207
- ], UserController);
208
- //# sourceMappingURL=user.controller.js.map
209
- //# sourceMappingURL=/Users/dianalau/code/loopback/loopback-next/extensions/sequelize/dist/__tests__/fixtures/controllers/user.controller.js.map