@loopback/example-references-many 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.dockerignore +5 -0
- package/.eslintrc.js +8 -0
- package/.prettierignore +2 -0
- package/.prettierrc +7 -0
- package/.vscode/settings.json +20 -0
- package/.vscode/tasks.json +29 -0
- package/CHANGELOG.md +25 -0
- package/Dockerfile +28 -0
- package/LICENSE +25 -0
- package/README.md +49 -0
- package/data/db.json +18 -0
- package/dist/__tests__/acceptance/account.acceptance.d.ts +1 -0
- package/dist/__tests__/acceptance/account.acceptance.js +111 -0
- package/dist/__tests__/acceptance/account.acceptance.js.map +1 -0
- package/dist/__tests__/acceptance/customer.acceptance.d.ts +1 -0
- package/dist/__tests__/acceptance/customer.acceptance.js +163 -0
- package/dist/__tests__/acceptance/customer.acceptance.js.map +1 -0
- package/dist/__tests__/acceptance/home-page.acceptance.d.ts +1 -0
- package/dist/__tests__/acceptance/home-page.acceptance.js +31 -0
- package/dist/__tests__/acceptance/home-page.acceptance.js.map +1 -0
- package/dist/__tests__/acceptance/test-helper.d.ts +7 -0
- package/dist/__tests__/acceptance/test-helper.js +20 -0
- package/dist/__tests__/acceptance/test-helper.js.map +1 -0
- package/dist/__tests__/helpers.d.ts +26 -0
- package/dist/__tests__/helpers.js +101 -0
- package/dist/__tests__/helpers.js.map +1 -0
- package/dist/__tests__/integration/customer.repository.integration.d.ts +1 -0
- package/dist/__tests__/integration/customer.repository.integration.js +61 -0
- package/dist/__tests__/integration/customer.repository.integration.js.map +1 -0
- package/dist/__tests__/unit/controllers/account.controller.unit.d.ts +1 -0
- package/dist/__tests__/unit/controllers/account.controller.unit.js +106 -0
- package/dist/__tests__/unit/controllers/account.controller.unit.js.map +1 -0
- package/dist/__tests__/unit/controllers/customer.controller.unit.d.ts +1 -0
- package/dist/__tests__/unit/controllers/customer.controller.unit.js +108 -0
- package/dist/__tests__/unit/controllers/customer.controller.unit.js.map +1 -0
- package/dist/application.d.ts +272 -0
- package/dist/application.js +41 -0
- package/dist/application.js.map +1 -0
- package/dist/controllers/account.controller.d.ts +15 -0
- package/dist/controllers/account.controller.js +192 -0
- package/dist/controllers/account.controller.js.map +1 -0
- package/dist/controllers/customer.controller.d.ts +15 -0
- package/dist/controllers/customer.controller.js +192 -0
- package/dist/controllers/customer.controller.js.map +1 -0
- package/dist/controllers/index.d.ts +2 -0
- package/dist/controllers/index.js +10 -0
- package/dist/controllers/index.js.map +1 -0
- package/dist/datasources/db.datasource.d.ts +12 -0
- package/dist/datasources/db.datasource.js +34 -0
- package/dist/datasources/db.datasource.js.map +1 -0
- package/dist/datasources/index.d.ts +1 -0
- package/dist/datasources/index.js +9 -0
- package/dist/datasources/index.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -0
- package/dist/migrate.d.ts +1 -0
- package/dist/migrate.js +25 -0
- package/dist/migrate.js.map +1 -0
- package/dist/models/account.model.d.ts +9 -0
- package/dist/models/account.model.js +35 -0
- package/dist/models/account.model.js.map +1 -0
- package/dist/models/customer.model.d.ts +13 -0
- package/dist/models/customer.model.js +45 -0
- package/dist/models/customer.model.js.map +1 -0
- package/dist/models/index.d.ts +2 -0
- package/dist/models/index.js +10 -0
- package/dist/models/index.js.map +1 -0
- package/dist/openapi-spec.d.ts +1 -0
- package/dist/openapi-spec.js +28 -0
- package/dist/openapi-spec.js.map +1 -0
- package/dist/repositories/account.repository.d.ts +6 -0
- package/dist/repositories/account.repository.js +23 -0
- package/dist/repositories/account.repository.js.map +1 -0
- package/dist/repositories/customer.repository.d.ts +11 -0
- package/dist/repositories/customer.repository.js +29 -0
- package/dist/repositories/customer.repository.js.map +1 -0
- package/dist/repositories/index.d.ts +2 -0
- package/dist/repositories/index.js +10 -0
- package/dist/repositories/index.js.map +1 -0
- package/dist/sequence.d.ts +3 -0
- package/dist/sequence.js +12 -0
- package/dist/sequence.js.map +1 -0
- package/package.json +78 -0
- package/public/index.html +72 -0
- package/src/__tests__/acceptance/account.acceptance.ts +139 -0
- package/src/__tests__/acceptance/customer.acceptance.ts +198 -0
- package/src/__tests__/acceptance/home-page.acceptance.ts +36 -0
- package/src/__tests__/acceptance/test-helper.ts +29 -0
- package/src/__tests__/helpers.ts +119 -0
- package/src/__tests__/integration/customer.repository.integration.ts +80 -0
- package/src/__tests__/unit/controllers/account.controller.unit.ts +127 -0
- package/src/__tests__/unit/controllers/customer.controller.unit.ts +136 -0
- package/src/application.ts +49 -0
- package/src/controllers/account.controller.ts +177 -0
- package/src/controllers/customer.controller.ts +177 -0
- package/src/controllers/index.ts +7 -0
- package/src/datasources/db.datasource.ts +34 -0
- package/src/datasources/index.ts +6 -0
- package/src/index.ts +42 -0
- package/src/migrate.ts +25 -0
- package/src/models/account.model.ts +31 -0
- package/src/models/customer.model.ts +40 -0
- package/src/models/index.ts +7 -0
- package/src/openapi-spec.ts +28 -0
- package/src/repositories/account.repository.ts +19 -0
- package/src/repositories/customer.repository.ts +42 -0
- package/src/repositories/index.ts +7 -0
- package/src/sequence.ts +8 -0
- package/tsconfig.json +39 -0
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright IBM Corp. and LoopBack contributors 2022. All Rights Reserved.
|
|
3
|
+
// Node module: @loopback/example-references-many
|
|
4
|
+
// This file is licensed under the MIT License.
|
|
5
|
+
// License text available at https://opensource.org/licenses/MIT
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.CustomerController = void 0;
|
|
8
|
+
const tslib_1 = require("tslib");
|
|
9
|
+
const repository_1 = require("@loopback/repository");
|
|
10
|
+
const rest_1 = require("@loopback/rest");
|
|
11
|
+
const models_1 = require("../models");
|
|
12
|
+
const repositories_1 = require("../repositories");
|
|
13
|
+
let CustomerController = class CustomerController {
|
|
14
|
+
constructor(customerRepository) {
|
|
15
|
+
this.customerRepository = customerRepository;
|
|
16
|
+
}
|
|
17
|
+
async create(customer) {
|
|
18
|
+
return this.customerRepository.create(customer);
|
|
19
|
+
}
|
|
20
|
+
async count(where) {
|
|
21
|
+
return this.customerRepository.count(where);
|
|
22
|
+
}
|
|
23
|
+
async find(filter) {
|
|
24
|
+
return this.customerRepository.find(filter);
|
|
25
|
+
}
|
|
26
|
+
async updateAll(customer, where) {
|
|
27
|
+
return this.customerRepository.updateAll(customer, where);
|
|
28
|
+
}
|
|
29
|
+
async findById(id, filter) {
|
|
30
|
+
return this.customerRepository.findById(id, filter);
|
|
31
|
+
}
|
|
32
|
+
async updateById(id, customer) {
|
|
33
|
+
await this.customerRepository.updateById(id, customer);
|
|
34
|
+
}
|
|
35
|
+
async deleteById(id) {
|
|
36
|
+
await this.customerRepository.deleteById(id);
|
|
37
|
+
}
|
|
38
|
+
async replaceById(id, customer) {
|
|
39
|
+
await this.customerRepository.replaceById(id, customer);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
tslib_1.__decorate([
|
|
43
|
+
(0, rest_1.post)('/customers', {
|
|
44
|
+
responses: {
|
|
45
|
+
'200': {
|
|
46
|
+
description: 'Customer model instance',
|
|
47
|
+
content: { 'application/json': { schema: (0, rest_1.getModelSchemaRef)(models_1.Customer) } },
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
}),
|
|
51
|
+
tslib_1.__param(0, (0, rest_1.requestBody)({
|
|
52
|
+
content: {
|
|
53
|
+
'application/json': {
|
|
54
|
+
schema: (0, rest_1.getModelSchemaRef)(models_1.Customer, {
|
|
55
|
+
title: 'NewCustomer',
|
|
56
|
+
exclude: ['id'],
|
|
57
|
+
}),
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
})),
|
|
61
|
+
tslib_1.__metadata("design:type", Function),
|
|
62
|
+
tslib_1.__metadata("design:paramtypes", [Object]),
|
|
63
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
64
|
+
], CustomerController.prototype, "create", null);
|
|
65
|
+
tslib_1.__decorate([
|
|
66
|
+
(0, rest_1.get)('/customers/count', {
|
|
67
|
+
responses: {
|
|
68
|
+
'200': {
|
|
69
|
+
description: 'Customer model count',
|
|
70
|
+
content: { 'application/json': { schema: repository_1.CountSchema } },
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
}),
|
|
74
|
+
tslib_1.__param(0, rest_1.param.where(models_1.Customer)),
|
|
75
|
+
tslib_1.__metadata("design:type", Function),
|
|
76
|
+
tslib_1.__metadata("design:paramtypes", [Object]),
|
|
77
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
78
|
+
], CustomerController.prototype, "count", null);
|
|
79
|
+
tslib_1.__decorate([
|
|
80
|
+
(0, rest_1.get)('/customers', {
|
|
81
|
+
responses: {
|
|
82
|
+
'200': {
|
|
83
|
+
description: 'Array of Customer model instances',
|
|
84
|
+
content: {
|
|
85
|
+
'application/json': {
|
|
86
|
+
schema: {
|
|
87
|
+
type: 'array',
|
|
88
|
+
items: (0, rest_1.getModelSchemaRef)(models_1.Customer, { includeRelations: true }),
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
}),
|
|
95
|
+
tslib_1.__param(0, rest_1.param.filter(models_1.Customer)),
|
|
96
|
+
tslib_1.__metadata("design:type", Function),
|
|
97
|
+
tslib_1.__metadata("design:paramtypes", [Object]),
|
|
98
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
99
|
+
], CustomerController.prototype, "find", null);
|
|
100
|
+
tslib_1.__decorate([
|
|
101
|
+
(0, rest_1.patch)('/customers', {
|
|
102
|
+
responses: {
|
|
103
|
+
'200': {
|
|
104
|
+
description: 'Customer PATCH success count',
|
|
105
|
+
content: { 'application/json': { schema: repository_1.CountSchema } },
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
}),
|
|
109
|
+
tslib_1.__param(0, (0, rest_1.requestBody)({
|
|
110
|
+
content: {
|
|
111
|
+
'application/json': {
|
|
112
|
+
schema: (0, rest_1.getModelSchemaRef)(models_1.Customer, { partial: true }),
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
})),
|
|
116
|
+
tslib_1.__param(1, rest_1.param.where(models_1.Customer)),
|
|
117
|
+
tslib_1.__metadata("design:type", Function),
|
|
118
|
+
tslib_1.__metadata("design:paramtypes", [models_1.Customer, Object]),
|
|
119
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
120
|
+
], CustomerController.prototype, "updateAll", null);
|
|
121
|
+
tslib_1.__decorate([
|
|
122
|
+
(0, rest_1.get)('/customers/{id}', {
|
|
123
|
+
responses: {
|
|
124
|
+
'200': {
|
|
125
|
+
description: 'Customer model instance',
|
|
126
|
+
content: {
|
|
127
|
+
'application/json': {
|
|
128
|
+
schema: (0, rest_1.getModelSchemaRef)(models_1.Customer, { includeRelations: true }),
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
}),
|
|
134
|
+
tslib_1.__param(0, rest_1.param.path.number('id')),
|
|
135
|
+
tslib_1.__param(1, rest_1.param.filter(models_1.Customer, { exclude: 'where' })),
|
|
136
|
+
tslib_1.__metadata("design:type", Function),
|
|
137
|
+
tslib_1.__metadata("design:paramtypes", [Number, Object]),
|
|
138
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
139
|
+
], CustomerController.prototype, "findById", null);
|
|
140
|
+
tslib_1.__decorate([
|
|
141
|
+
(0, rest_1.patch)('/customers/{id}', {
|
|
142
|
+
responses: {
|
|
143
|
+
'204': {
|
|
144
|
+
description: 'Customer PATCH success',
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
}),
|
|
148
|
+
tslib_1.__param(0, rest_1.param.path.number('id')),
|
|
149
|
+
tslib_1.__param(1, (0, rest_1.requestBody)({
|
|
150
|
+
content: {
|
|
151
|
+
'application/json': {
|
|
152
|
+
schema: (0, rest_1.getModelSchemaRef)(models_1.Customer, { partial: true }),
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
})),
|
|
156
|
+
tslib_1.__metadata("design:type", Function),
|
|
157
|
+
tslib_1.__metadata("design:paramtypes", [Number, models_1.Customer]),
|
|
158
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
159
|
+
], CustomerController.prototype, "updateById", null);
|
|
160
|
+
tslib_1.__decorate([
|
|
161
|
+
(0, rest_1.del)('/customers/{id}', {
|
|
162
|
+
responses: {
|
|
163
|
+
'204': {
|
|
164
|
+
description: 'Customer DELETE success',
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
}),
|
|
168
|
+
tslib_1.__param(0, rest_1.param.path.number('id')),
|
|
169
|
+
tslib_1.__metadata("design:type", Function),
|
|
170
|
+
tslib_1.__metadata("design:paramtypes", [Number]),
|
|
171
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
172
|
+
], CustomerController.prototype, "deleteById", null);
|
|
173
|
+
tslib_1.__decorate([
|
|
174
|
+
(0, rest_1.put)('/customers/{id}', {
|
|
175
|
+
responses: {
|
|
176
|
+
'204': {
|
|
177
|
+
description: 'Customer PUT success',
|
|
178
|
+
},
|
|
179
|
+
},
|
|
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.Customer]),
|
|
185
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
186
|
+
], CustomerController.prototype, "replaceById", null);
|
|
187
|
+
CustomerController = tslib_1.__decorate([
|
|
188
|
+
tslib_1.__param(0, (0, repository_1.repository)(repositories_1.CustomerRepository)),
|
|
189
|
+
tslib_1.__metadata("design:paramtypes", [repositories_1.CustomerRepository])
|
|
190
|
+
], CustomerController);
|
|
191
|
+
exports.CustomerController = CustomerController;
|
|
192
|
+
//# sourceMappingURL=customer.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":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AE,IAAA,wBAAiB,EAAC,iBAAQ,EAAE,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;aACrD;SACF;KACF,CAAC,CAAA;;qDACQ,iBAAQ;;oDAGnB;AASD;IAPC,IAAA,UAAG,EAAC,iBAAiB,EAAE;QACtB,SAAS,EAAE;YACT,KAAK,EAAE;gBACL,WAAW,EAAE,yBAAyB;aACvC;SACF;KACF,CAAC;IACgB,mBAAA,YAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;;;;oDAExC;AASD;IAPC,IAAA,UAAG,EAAC,iBAAiB,EAAE;QACtB,SAAS,EAAE;YACT,KAAK,EAAE;gBACL,WAAW,EAAE,sBAAsB;aACpC;SACF;KACF,CAAC;IAEC,mBAAA,YAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IACvB,mBAAA,IAAA,kBAAW,GAAE,CAAA;;qDAAW,iBAAQ;;qDAGlC;AArJU,kBAAkB;IAE1B,mBAAA,IAAA,uBAAU,EAAC,iCAAkB,CAAC,CAAA;6CACJ,iCAAkB;GAHpC,kBAAkB,CAsJ9B;AAtJY,gDAAkB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright IBM Corp. and LoopBack contributors 2022. All Rights Reserved.
|
|
3
|
+
// Node module: @loopback/example-references-many
|
|
4
|
+
// This file is licensed under the MIT License.
|
|
5
|
+
// License text available at https://opensource.org/licenses/MIT
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const tslib_1 = require("tslib");
|
|
8
|
+
tslib_1.__exportStar(require("./account.controller"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./customer.controller"), exports);
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/controllers/index.ts"],"names":[],"mappings":";AAAA,2EAA2E;AAC3E,iDAAiD;AACjD,+CAA+C;AAC/C,gEAAgE;;;AAEhE,+DAAqC;AACrC,gEAAsC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { LifeCycleObserver } from '@loopback/core';
|
|
2
|
+
import { juggler } from '@loopback/repository';
|
|
3
|
+
export declare class DbDataSource extends juggler.DataSource implements LifeCycleObserver {
|
|
4
|
+
static dataSourceName: string;
|
|
5
|
+
static readonly defaultConfig: {
|
|
6
|
+
name: string;
|
|
7
|
+
connector: string;
|
|
8
|
+
localStorage: string;
|
|
9
|
+
file: string;
|
|
10
|
+
};
|
|
11
|
+
constructor(dsConfig?: object);
|
|
12
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright IBM Corp. and LoopBack contributors 2022. All Rights Reserved.
|
|
3
|
+
// Node module: @loopback/example-references-many
|
|
4
|
+
// This file is licensed under the MIT License.
|
|
5
|
+
// License text available at https://opensource.org/licenses/MIT
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.DbDataSource = void 0;
|
|
8
|
+
const tslib_1 = require("tslib");
|
|
9
|
+
const core_1 = require("@loopback/core");
|
|
10
|
+
const repository_1 = require("@loopback/repository");
|
|
11
|
+
const config = {
|
|
12
|
+
name: 'db',
|
|
13
|
+
connector: 'memory',
|
|
14
|
+
localStorage: '',
|
|
15
|
+
file: './data/db.json',
|
|
16
|
+
};
|
|
17
|
+
// Observe application's life cycle to disconnect the datasource when
|
|
18
|
+
// application is stopped. This allows the application to be shut down
|
|
19
|
+
// gracefully. The `stop()` method is inherited from `juggler.DataSource`.
|
|
20
|
+
// Learn more at https://loopback.io/doc/en/lb4/Life-cycle.html
|
|
21
|
+
let DbDataSource = class DbDataSource extends repository_1.juggler.DataSource {
|
|
22
|
+
constructor(dsConfig = config) {
|
|
23
|
+
super(dsConfig);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
DbDataSource.dataSourceName = 'db';
|
|
27
|
+
DbDataSource.defaultConfig = config;
|
|
28
|
+
DbDataSource = tslib_1.__decorate([
|
|
29
|
+
(0, core_1.lifeCycleObserver)('datasource'),
|
|
30
|
+
tslib_1.__param(0, (0, core_1.inject)('datasources.config.db', { optional: true })),
|
|
31
|
+
tslib_1.__metadata("design:paramtypes", [Object])
|
|
32
|
+
], DbDataSource);
|
|
33
|
+
exports.DbDataSource = DbDataSource;
|
|
34
|
+
//# sourceMappingURL=db.datasource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"db.datasource.js","sourceRoot":"","sources":["../../src/datasources/db.datasource.ts"],"names":[],"mappings":";AAAA,2EAA2E;AAC3E,iDAAiD;AACjD,+CAA+C;AAC/C,gEAAgE;;;;AAEhE,yCAA4E;AAC5E,qDAA6C;AAE7C,MAAM,MAAM,GAAG;IACb,IAAI,EAAE,IAAI;IACV,SAAS,EAAE,QAAQ;IACnB,YAAY,EAAE,EAAE;IAChB,IAAI,EAAE,gBAAgB;CACvB,CAAC;AAEF,qEAAqE;AACrE,sEAAsE;AACtE,0EAA0E;AAC1E,+DAA+D;AAE/D,IAAa,YAAY,GAAzB,MAAa,YACX,SAAQ,oBAAO,CAAC,UAAU;IAM1B,YAEE,WAAmB,MAAM;QAEzB,KAAK,CAAC,QAAQ,CAAC,CAAC;IAClB,CAAC;CACF,CAAA;AATQ,2BAAc,GAAG,IAAI,CAAC;AACb,0BAAa,GAAG,MAAO,CAAA;AAL5B,YAAY;IADxB,IAAA,wBAAiB,EAAC,YAAY,CAAC;IAS3B,mBAAA,IAAA,aAAM,EAAC,uBAAuB,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC,CAAA;;GARzC,YAAY,CAaxB;AAbY,oCAAY"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './db.datasource';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright IBM Corp. and LoopBack contributors 2018,2020 All Rights Reserved.
|
|
3
|
+
// Node module: @loopback/example-references-many
|
|
4
|
+
// This file is licensed under the MIT License.
|
|
5
|
+
// License text available at https://opensource.org/licenses/MIT
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const tslib_1 = require("tslib");
|
|
8
|
+
tslib_1.__exportStar(require("./db.datasource"), exports);
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/datasources/index.ts"],"names":[],"mappings":";AAAA,+EAA+E;AAC/E,iDAAiD;AACjD,+CAA+C;AAC/C,gEAAgE;;;AAEhE,0DAAgC"}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright IBM Corp. and LoopBack contributors 2022. All Rights Reserved.
|
|
3
|
+
// Node module: @loopback/example-references-many
|
|
4
|
+
// This file is licensed under the MIT License.
|
|
5
|
+
// License text available at https://opensource.org/licenses/MIT
|
|
6
|
+
var _a;
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.main = void 0;
|
|
9
|
+
const tslib_1 = require("tslib");
|
|
10
|
+
const application_1 = require("./application");
|
|
11
|
+
tslib_1.__exportStar(require("./application"), exports);
|
|
12
|
+
async function main(options = {}) {
|
|
13
|
+
const app = new application_1.ReferencesManyApplication(options);
|
|
14
|
+
await app.boot();
|
|
15
|
+
await app.start();
|
|
16
|
+
const url = app.restServer.url;
|
|
17
|
+
console.log(`Server is running at ${url}`);
|
|
18
|
+
return app;
|
|
19
|
+
}
|
|
20
|
+
exports.main = main;
|
|
21
|
+
if (require.main === module) {
|
|
22
|
+
// Run the application
|
|
23
|
+
const config = {
|
|
24
|
+
rest: {
|
|
25
|
+
port: +((_a = process.env.PORT) !== null && _a !== void 0 ? _a : 3000),
|
|
26
|
+
host: process.env.HOST,
|
|
27
|
+
// The `gracePeriodForClose` provides a graceful close for http/https
|
|
28
|
+
// servers with keep-alive clients. The default value is `Infinity`
|
|
29
|
+
// (don't force-close). If you want to immediately destroy all sockets
|
|
30
|
+
// upon stop, set its value to `0`.
|
|
31
|
+
// See https://www.npmjs.com/package/stoppable
|
|
32
|
+
gracePeriodForClose: 5000,
|
|
33
|
+
openApiSpec: {
|
|
34
|
+
// useful when used with OpenAPI-to-GraphQL to locate your application
|
|
35
|
+
setServersFromRequest: true,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
main(config).catch(err => {
|
|
40
|
+
console.error('Cannot start the application.', err);
|
|
41
|
+
process.exit(1);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,2EAA2E;AAC3E,iDAAiD;AACjD,+CAA+C;AAC/C,gEAAgE;;;;;AAEhE,+CAA2E;AAE3E,wDAA8B;AAEvB,KAAK,UAAU,IAAI,CAAC,UAA6B,EAAE;IACxD,MAAM,GAAG,GAAG,IAAI,uCAAyB,CAAC,OAAO,CAAC,CAAC;IACnD,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;IACjB,MAAM,GAAG,CAAC,KAAK,EAAE,CAAC;IAElB,MAAM,GAAG,GAAG,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC;IAC/B,OAAO,CAAC,GAAG,CAAC,wBAAwB,GAAG,EAAE,CAAC,CAAC;IAC3C,OAAO,GAAG,CAAC;AACb,CAAC;AARD,oBAQC;AAED,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE;IAC3B,sBAAsB;IACtB,MAAM,MAAM,GAAG;QACb,IAAI,EAAE;YACJ,IAAI,EAAE,CAAC,CAAC,MAAA,OAAO,CAAC,GAAG,CAAC,IAAI,mCAAI,IAAI,CAAC;YACjC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI;YACtB,qEAAqE;YACrE,mEAAmE;YACnE,sEAAsE;YACtE,mCAAmC;YACnC,8CAA8C;YAC9C,mBAAmB,EAAE,IAAI;YACzB,WAAW,EAAE;gBACX,sEAAsE;gBACtE,qBAAqB,EAAE,IAAI;aAC5B;SACF;KACF,CAAC;IACF,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;QACvB,OAAO,CAAC,KAAK,CAAC,+BAA+B,EAAE,GAAG,CAAC,CAAC;QACpD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;CACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function migrate(args: string[]): Promise<void>;
|
package/dist/migrate.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright IBM Corp. and LoopBack contributors 2022. All Rights Reserved.
|
|
3
|
+
// Node module: @loopback/example-references-many
|
|
4
|
+
// This file is licensed under the MIT License.
|
|
5
|
+
// License text available at https://opensource.org/licenses/MIT
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.migrate = void 0;
|
|
8
|
+
const application_1 = require("./application");
|
|
9
|
+
async function migrate(args) {
|
|
10
|
+
const existingSchema = args.includes('--rebuild') ? 'drop' : 'alter';
|
|
11
|
+
console.log('Migrating schemas (%s existing schema)', existingSchema);
|
|
12
|
+
const app = new application_1.ReferencesManyApplication();
|
|
13
|
+
await app.boot();
|
|
14
|
+
await app.migrateSchema({ existingSchema });
|
|
15
|
+
// Connectors usually keep a pool of opened connections,
|
|
16
|
+
// this keeps the process running even after all work is done.
|
|
17
|
+
// We need to exit explicitly.
|
|
18
|
+
process.exit(0);
|
|
19
|
+
}
|
|
20
|
+
exports.migrate = migrate;
|
|
21
|
+
migrate(process.argv).catch(err => {
|
|
22
|
+
console.error('Cannot migrate database schema', err);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=migrate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate.js","sourceRoot":"","sources":["../src/migrate.ts"],"names":[],"mappings":";AAAA,2EAA2E;AAC3E,iDAAiD;AACjD,+CAA+C;AAC/C,gEAAgE;;;AAEhE,+CAAwD;AAEjD,KAAK,UAAU,OAAO,CAAC,IAAc;IAC1C,MAAM,cAAc,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IACrE,OAAO,CAAC,GAAG,CAAC,wCAAwC,EAAE,cAAc,CAAC,CAAC;IAEtE,MAAM,GAAG,GAAG,IAAI,uCAAyB,EAAE,CAAC;IAC5C,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;IACjB,MAAM,GAAG,CAAC,aAAa,CAAC,EAAC,cAAc,EAAC,CAAC,CAAC;IAE1C,wDAAwD;IACxD,8DAA8D;IAC9D,8BAA8B;IAC9B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAZD,0BAYC;AAED,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;IAChC,OAAO,CAAC,KAAK,CAAC,gCAAgC,EAAE,GAAG,CAAC,CAAC;IACrD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Entity } from '@loopback/repository';
|
|
2
|
+
export declare class Account extends Entity {
|
|
3
|
+
id: number;
|
|
4
|
+
balance: number;
|
|
5
|
+
constructor(data?: Partial<Account>);
|
|
6
|
+
}
|
|
7
|
+
export interface AccountRelations {
|
|
8
|
+
}
|
|
9
|
+
export declare type AccountWithRelations = Account & AccountRelations;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Account = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Copyright IBM Corp. and LoopBack contributors 2022. All Rights Reserved.
|
|
6
|
+
// Node module: @loopback/example-references-many
|
|
7
|
+
// This file is licensed under the MIT License.
|
|
8
|
+
// License text available at https://opensource.org/licenses/MIT
|
|
9
|
+
const repository_1 = require("@loopback/repository");
|
|
10
|
+
let Account = class Account extends repository_1.Entity {
|
|
11
|
+
constructor(data) {
|
|
12
|
+
super(data);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
tslib_1.__decorate([
|
|
16
|
+
(0, repository_1.property)({
|
|
17
|
+
type: 'number',
|
|
18
|
+
id: true,
|
|
19
|
+
generated: false,
|
|
20
|
+
}),
|
|
21
|
+
tslib_1.__metadata("design:type", Number)
|
|
22
|
+
], Account.prototype, "id", void 0);
|
|
23
|
+
tslib_1.__decorate([
|
|
24
|
+
(0, repository_1.property)({
|
|
25
|
+
type: 'number',
|
|
26
|
+
default: 0,
|
|
27
|
+
}),
|
|
28
|
+
tslib_1.__metadata("design:type", Number)
|
|
29
|
+
], Account.prototype, "balance", void 0);
|
|
30
|
+
Account = tslib_1.__decorate([
|
|
31
|
+
(0, repository_1.model)(),
|
|
32
|
+
tslib_1.__metadata("design:paramtypes", [Object])
|
|
33
|
+
], Account);
|
|
34
|
+
exports.Account = Account;
|
|
35
|
+
//# sourceMappingURL=account.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.model.js","sourceRoot":"","sources":["../../src/models/account.model.ts"],"names":[],"mappings":";;;;AAAA,2EAA2E;AAC3E,iDAAiD;AACjD,+CAA+C;AAC/C,gEAAgE;AAChE,qDAA6D;AAG7D,IAAa,OAAO,GAApB,MAAa,OAAQ,SAAQ,mBAAM;IAcjC,YAAY,IAAuB;QACjC,KAAK,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;CACF,CAAA;AAXC;IALC,IAAA,qBAAQ,EAAC;QACR,IAAI,EAAE,QAAQ;QACd,EAAE,EAAE,IAAI;QACR,SAAS,EAAE,KAAK;KACjB,CAAC;;mCACS;AAMX;IAJC,IAAA,qBAAQ,EAAC;QACR,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,CAAC;KACX,CAAC;;wCACc;AAZL,OAAO;IADnB,IAAA,kBAAK,GAAE;;GACK,OAAO,CAiBnB;AAjBY,0BAAO"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Entity } from '@loopback/repository';
|
|
2
|
+
import { AccountWithRelations } from './account.model';
|
|
3
|
+
export declare class Customer extends Entity {
|
|
4
|
+
id: number;
|
|
5
|
+
firstName: string;
|
|
6
|
+
lastName: string;
|
|
7
|
+
accountIds?: number[];
|
|
8
|
+
constructor(data?: Partial<Customer>);
|
|
9
|
+
}
|
|
10
|
+
export interface CustomerRelations {
|
|
11
|
+
accounts?: AccountWithRelations;
|
|
12
|
+
}
|
|
13
|
+
export declare type CustomerWithRelations = Customer & CustomerRelations;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright IBM Corp. and LoopBack contributors 2022. All Rights Reserved.
|
|
3
|
+
// Node module: @loopback/example-references-many
|
|
4
|
+
// This file is licensed under the MIT License.
|
|
5
|
+
// License text available at https://opensource.org/licenses/MIT
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.Customer = void 0;
|
|
8
|
+
const tslib_1 = require("tslib");
|
|
9
|
+
const repository_1 = require("@loopback/repository");
|
|
10
|
+
const account_model_1 = require("./account.model");
|
|
11
|
+
let Customer = class Customer extends repository_1.Entity {
|
|
12
|
+
constructor(data) {
|
|
13
|
+
super(data);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
tslib_1.__decorate([
|
|
17
|
+
(0, repository_1.property)({
|
|
18
|
+
type: 'number',
|
|
19
|
+
id: true,
|
|
20
|
+
generated: true,
|
|
21
|
+
}),
|
|
22
|
+
tslib_1.__metadata("design:type", Number)
|
|
23
|
+
], Customer.prototype, "id", void 0);
|
|
24
|
+
tslib_1.__decorate([
|
|
25
|
+
(0, repository_1.property)({
|
|
26
|
+
type: 'string',
|
|
27
|
+
}),
|
|
28
|
+
tslib_1.__metadata("design:type", String)
|
|
29
|
+
], Customer.prototype, "firstName", void 0);
|
|
30
|
+
tslib_1.__decorate([
|
|
31
|
+
(0, repository_1.property)({
|
|
32
|
+
type: 'string',
|
|
33
|
+
}),
|
|
34
|
+
tslib_1.__metadata("design:type", String)
|
|
35
|
+
], Customer.prototype, "lastName", void 0);
|
|
36
|
+
tslib_1.__decorate([
|
|
37
|
+
(0, repository_1.referencesMany)(() => account_model_1.Account),
|
|
38
|
+
tslib_1.__metadata("design:type", Array)
|
|
39
|
+
], Customer.prototype, "accountIds", void 0);
|
|
40
|
+
Customer = tslib_1.__decorate([
|
|
41
|
+
(0, repository_1.model)(),
|
|
42
|
+
tslib_1.__metadata("design:paramtypes", [Object])
|
|
43
|
+
], Customer);
|
|
44
|
+
exports.Customer = Customer;
|
|
45
|
+
//# sourceMappingURL=customer.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customer.model.js","sourceRoot":"","sources":["../../src/models/customer.model.ts"],"names":[],"mappings":";AAAA,2EAA2E;AAC3E,iDAAiD;AACjD,+CAA+C;AAC/C,gEAAgE;;;;AAEhE,qDAA6E;AAC7E,mDAA8D;AAG9D,IAAa,QAAQ,GAArB,MAAa,QAAS,SAAQ,mBAAM;IAqBlC,YAAY,IAAwB;QAClC,KAAK,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;CACF,CAAA;AAlBC;IALC,IAAA,qBAAQ,EAAC;QACR,IAAI,EAAE,QAAQ;QACd,EAAE,EAAE,IAAI;QACR,SAAS,EAAE,IAAI;KAChB,CAAC;;oCACS;AAKX;IAHC,IAAA,qBAAQ,EAAC;QACR,IAAI,EAAE,QAAQ;KACf,CAAC;;2CACgB;AAKlB;IAHC,IAAA,qBAAQ,EAAC;QACR,IAAI,EAAE,QAAQ;KACf,CAAC;;0CACe;AAGjB;IADC,IAAA,2BAAc,EAAC,GAAG,EAAE,CAAC,uBAAO,CAAC;;4CACR;AAnBX,QAAQ;IADpB,IAAA,kBAAK,GAAE;;GACK,QAAQ,CAwBpB;AAxBY,4BAAQ"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright IBM Corp. and LoopBack contributors 2018,2020 All Rights Reserved.
|
|
3
|
+
// Node module: @loopback/example-references-many
|
|
4
|
+
// This file is licensed under the MIT License.
|
|
5
|
+
// License text available at https://opensource.org/licenses/MIT
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const tslib_1 = require("tslib");
|
|
8
|
+
tslib_1.__exportStar(require("./account.model"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./customer.model"), exports);
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":";AAAA,+EAA+E;AAC/E,iDAAiD;AACjD,+CAA+C;AAC/C,gEAAgE;;;AAEhE,0DAAgC;AAChC,2DAAiC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright IBM Corp. and LoopBack contributors 2020. All Rights Reserved.
|
|
3
|
+
// Node module: @loopback/example-references-many
|
|
4
|
+
// This file is licensed under the MIT License.
|
|
5
|
+
// License text available at https://opensource.org/licenses/MIT
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const application_1 = require("./application");
|
|
8
|
+
/**
|
|
9
|
+
* Export the OpenAPI spec from the application
|
|
10
|
+
*/
|
|
11
|
+
async function exportOpenApiSpec() {
|
|
12
|
+
var _a, _b, _c;
|
|
13
|
+
const config = {
|
|
14
|
+
rest: {
|
|
15
|
+
port: +((_a = process.env.PORT) !== null && _a !== void 0 ? _a : 3000),
|
|
16
|
+
host: (_b = process.env.HOST) !== null && _b !== void 0 ? _b : 'localhost',
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
const outFile = (_c = process.argv[2]) !== null && _c !== void 0 ? _c : '';
|
|
20
|
+
const app = new application_1.ReferencesManyApplication(config);
|
|
21
|
+
await app.boot();
|
|
22
|
+
await app.exportOpenApiSpec(outFile);
|
|
23
|
+
}
|
|
24
|
+
exportOpenApiSpec().catch(err => {
|
|
25
|
+
console.error('Fail to export OpenAPI spec from the application.', err);
|
|
26
|
+
process.exit(1);
|
|
27
|
+
});
|
|
28
|
+
//# sourceMappingURL=openapi-spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openapi-spec.js","sourceRoot":"","sources":["../src/openapi-spec.ts"],"names":[],"mappings":";AAAA,2EAA2E;AAC3E,iDAAiD;AACjD,+CAA+C;AAC/C,gEAAgE;;AAGhE,+CAAwD;AAExD;;GAEG;AACH,KAAK,UAAU,iBAAiB;;IAC9B,MAAM,MAAM,GAAsB;QAChC,IAAI,EAAE;YACJ,IAAI,EAAE,CAAC,CAAC,MAAA,OAAO,CAAC,GAAG,CAAC,IAAI,mCAAI,IAAI,CAAC;YACjC,IAAI,EAAE,MAAA,OAAO,CAAC,GAAG,CAAC,IAAI,mCAAI,WAAW;SACtC;KACF,CAAC;IACF,MAAM,OAAO,GAAG,MAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,mCAAI,EAAE,CAAC;IACtC,MAAM,GAAG,GAAG,IAAI,uCAAyB,CAAC,MAAM,CAAC,CAAC;IAClD,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;IACjB,MAAM,GAAG,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;AACvC,CAAC;AAED,iBAAiB,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;IAC9B,OAAO,CAAC,KAAK,CAAC,mDAAmD,EAAE,GAAG,CAAC,CAAC;IACxE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DefaultCrudRepository } from '@loopback/repository';
|
|
2
|
+
import { DbDataSource } from '../datasources';
|
|
3
|
+
import { Account, AccountRelations } from '../models';
|
|
4
|
+
export declare class AccountRepository extends DefaultCrudRepository<Account, typeof Account.prototype.id, AccountRelations> {
|
|
5
|
+
constructor(dataSource: DbDataSource);
|
|
6
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright IBM Corp. and LoopBack contributors 2022. All Rights Reserved.
|
|
3
|
+
// Node module: @loopback/example-references-many
|
|
4
|
+
// This file is licensed under the MIT License.
|
|
5
|
+
// License text available at https://opensource.org/licenses/MIT
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.AccountRepository = void 0;
|
|
8
|
+
const tslib_1 = require("tslib");
|
|
9
|
+
const core_1 = require("@loopback/core");
|
|
10
|
+
const repository_1 = require("@loopback/repository");
|
|
11
|
+
const datasources_1 = require("../datasources");
|
|
12
|
+
const models_1 = require("../models");
|
|
13
|
+
let AccountRepository = class AccountRepository extends repository_1.DefaultCrudRepository {
|
|
14
|
+
constructor(dataSource) {
|
|
15
|
+
super(models_1.Account, dataSource);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
AccountRepository = tslib_1.__decorate([
|
|
19
|
+
tslib_1.__param(0, (0, core_1.inject)('datasources.db')),
|
|
20
|
+
tslib_1.__metadata("design:paramtypes", [datasources_1.DbDataSource])
|
|
21
|
+
], AccountRepository);
|
|
22
|
+
exports.AccountRepository = AccountRepository;
|
|
23
|
+
//# sourceMappingURL=account.repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.repository.js","sourceRoot":"","sources":["../../src/repositories/account.repository.ts"],"names":[],"mappings":";AAAA,2EAA2E;AAC3E,iDAAiD;AACjD,+CAA+C;AAC/C,gEAAgE;;;;AAEhE,yCAAsC;AACtC,qDAA2D;AAC3D,gDAA4C;AAC5C,sCAAoD;AAEpD,IAAa,iBAAiB,GAA9B,MAAa,iBAAkB,SAAQ,kCAItC;IACC,YAAsC,UAAwB;QAC5D,KAAK,CAAC,gBAAO,EAAE,UAAU,CAAC,CAAC;IAC7B,CAAC;CACF,CAAA;AARY,iBAAiB;IAKf,mBAAA,IAAA,aAAM,EAAC,gBAAgB,CAAC,CAAA;6CAAa,0BAAY;GALnD,iBAAiB,CAQ7B;AARY,8CAAiB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Getter } from '@loopback/core';
|
|
2
|
+
import { DefaultCrudRepository, ReferencesManyAccessor } from '@loopback/repository';
|
|
3
|
+
import { DbDataSource } from '../datasources';
|
|
4
|
+
import { Account, Customer, CustomerRelations } from '../models';
|
|
5
|
+
import { AccountRepository } from './account.repository';
|
|
6
|
+
export declare class CustomerRepository extends DefaultCrudRepository<Customer, typeof Customer.prototype.id, CustomerRelations> {
|
|
7
|
+
protected accountRepositoryGetter: Getter<AccountRepository>;
|
|
8
|
+
protected customerRepositoryGetter: Getter<CustomerRepository>;
|
|
9
|
+
readonly accounts: ReferencesManyAccessor<Account, typeof Account.prototype.id>;
|
|
10
|
+
constructor(dataSource: DbDataSource, accountRepositoryGetter: Getter<AccountRepository>, customerRepositoryGetter: Getter<CustomerRepository>);
|
|
11
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright IBM Corp. and LoopBack contributors 2022. All Rights Reserved.
|
|
3
|
+
// Node module: @loopback/example-references-many
|
|
4
|
+
// This file is licensed under the MIT License.
|
|
5
|
+
// License text available at https://opensource.org/licenses/MIT
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.CustomerRepository = void 0;
|
|
8
|
+
const tslib_1 = require("tslib");
|
|
9
|
+
const core_1 = require("@loopback/core");
|
|
10
|
+
const repository_1 = require("@loopback/repository");
|
|
11
|
+
const datasources_1 = require("../datasources");
|
|
12
|
+
const models_1 = require("../models");
|
|
13
|
+
let CustomerRepository = class CustomerRepository extends repository_1.DefaultCrudRepository {
|
|
14
|
+
constructor(dataSource, accountRepositoryGetter, customerRepositoryGetter) {
|
|
15
|
+
super(models_1.Customer, dataSource);
|
|
16
|
+
this.accountRepositoryGetter = accountRepositoryGetter;
|
|
17
|
+
this.customerRepositoryGetter = customerRepositoryGetter;
|
|
18
|
+
this.accounts = this.createReferencesManyAccessorFor('accounts', accountRepositoryGetter);
|
|
19
|
+
this.registerInclusionResolver('accounts', this.accounts.inclusionResolver);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
CustomerRepository = tslib_1.__decorate([
|
|
23
|
+
tslib_1.__param(0, (0, core_1.inject)('datasources.db')),
|
|
24
|
+
tslib_1.__param(1, repository_1.repository.getter('AccountRepository')),
|
|
25
|
+
tslib_1.__param(2, repository_1.repository.getter('CustomerRepository')),
|
|
26
|
+
tslib_1.__metadata("design:paramtypes", [datasources_1.DbDataSource, Function, Function])
|
|
27
|
+
], CustomerRepository);
|
|
28
|
+
exports.CustomerRepository = CustomerRepository;
|
|
29
|
+
//# sourceMappingURL=customer.repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customer.repository.js","sourceRoot":"","sources":["../../src/repositories/customer.repository.ts"],"names":[],"mappings":";AAAA,2EAA2E;AAC3E,iDAAiD;AACjD,+CAA+C;AAC/C,gEAAgE;;;;AAEhE,yCAA8C;AAC9C,qDAI8B;AAC9B,gDAA4C;AAC5C,sCAA+D;AAG/D,IAAa,kBAAkB,GAA/B,MAAa,kBAAmB,SAAQ,kCAIvC;IAMC,YAC4B,UAAwB,EAExC,uBAAkD,EAElD,wBAAoD;QAE9D,KAAK,CAAC,iBAAQ,EAAE,UAAU,CAAC,CAAC;QAJlB,4BAAuB,GAAvB,uBAAuB,CAA2B;QAElD,6BAAwB,GAAxB,wBAAwB,CAA4B;QAI9D,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,+BAA+B,CAClD,UAAU,EACV,uBAAuB,CACxB,CAAC;QAEF,IAAI,CAAC,yBAAyB,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC;IAC9E,CAAC;CACF,CAAA;AA1BY,kBAAkB;IAW1B,mBAAA,IAAA,aAAM,EAAC,gBAAgB,CAAC,CAAA;IACxB,mBAAA,uBAAU,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAA;IAEtC,mBAAA,uBAAU,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAA;6CAHF,0BAAY;GAXzC,kBAAkB,CA0B9B;AA1BY,gDAAkB"}
|