trucostars-core-module 0.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/LICENSE +21 -0
- package/README.md +423 -0
- package/dist/app.controller.d.ts +6 -0
- package/dist/app.controller.js +43 -0
- package/dist/app.controller.js.map +1 -0
- package/dist/app.module.d.ts +4 -0
- package/dist/app.module.js +31 -0
- package/dist/app.module.js.map +1 -0
- package/dist/app.service.d.ts +5 -0
- package/dist/app.service.js +28 -0
- package/dist/app.service.js.map +1 -0
- package/dist/common/common.module.d.ts +2 -0
- package/dist/common/common.module.js +58 -0
- package/dist/common/common.module.js.map +1 -0
- package/dist/common/config/env.validation.d.ts +2 -0
- package/dist/common/config/env.validation.js +93 -0
- package/dist/common/config/env.validation.js.map +1 -0
- package/dist/common/config/firebase.config.d.ts +2 -0
- package/dist/common/config/firebase.config.js +9 -0
- package/dist/common/config/firebase.config.js.map +1 -0
- package/dist/common/config/index.d.ts +1 -0
- package/dist/common/config/index.js +18 -0
- package/dist/common/config/index.js.map +1 -0
- package/dist/common/database/database.module.d.ts +2 -0
- package/dist/common/database/database.module.js +54 -0
- package/dist/common/database/database.module.js.map +1 -0
- package/dist/common/database/database.service.d.ts +25 -0
- package/dist/common/database/database.service.js +91 -0
- package/dist/common/database/database.service.js.map +1 -0
- package/dist/common/decorators/api-performance.decorator.d.ts +1 -0
- package/dist/common/decorators/api-performance.decorator.js +42 -0
- package/dist/common/decorators/api-performance.decorator.js.map +1 -0
- package/dist/common/decorators/index.d.ts +1 -0
- package/dist/common/decorators/index.js +18 -0
- package/dist/common/decorators/index.js.map +1 -0
- package/dist/common/filters/all-exceptions.filter.d.ts +5 -0
- package/dist/common/filters/all-exceptions.filter.js +38 -0
- package/dist/common/filters/all-exceptions.filter.js.map +1 -0
- package/dist/common/firebase/firebase.controller.d.ts +35 -0
- package/dist/common/firebase/firebase.controller.js +115 -0
- package/dist/common/firebase/firebase.controller.js.map +1 -0
- package/dist/common/firebase/firebase.module.d.ts +3 -0
- package/dist/common/firebase/firebase.module.js +83 -0
- package/dist/common/firebase/firebase.module.js.map +1 -0
- package/dist/common/firebase/firebase.service.d.ts +17 -0
- package/dist/common/firebase/firebase.service.js +127 -0
- package/dist/common/firebase/firebase.service.js.map +1 -0
- package/dist/common/firebase/firebase.types.d.ts +22 -0
- package/dist/common/firebase/firebase.types.js +3 -0
- package/dist/common/firebase/firebase.types.js.map +1 -0
- package/dist/common/interceptors/logging.interceptor.d.ts +10 -0
- package/dist/common/interceptors/logging.interceptor.js +108 -0
- package/dist/common/interceptors/logging.interceptor.js.map +1 -0
- package/dist/common/interceptors/performance.interceptor.d.ts +7 -0
- package/dist/common/interceptors/performance.interceptor.js +58 -0
- package/dist/common/interceptors/performance.interceptor.js.map +1 -0
- package/dist/common/middleware/logger.middleware.d.ts +19 -0
- package/dist/common/middleware/logger.middleware.js +231 -0
- package/dist/common/middleware/logger.middleware.js.map +1 -0
- package/dist/common/redis/redis.module.d.ts +2 -0
- package/dist/common/redis/redis.module.js +21 -0
- package/dist/common/redis/redis.module.js.map +1 -0
- package/dist/common/redis/redis.service.d.ts +11 -0
- package/dist/common/redis/redis.service.js +52 -0
- package/dist/common/redis/redis.service.js.map +1 -0
- package/dist/common/sqs/sqs.consumer.d.ts +20 -0
- package/dist/common/sqs/sqs.consumer.js +140 -0
- package/dist/common/sqs/sqs.consumer.js.map +1 -0
- package/dist/common/sqs/sqs.controller.d.ts +21 -0
- package/dist/common/sqs/sqs.controller.js +70 -0
- package/dist/common/sqs/sqs.controller.js.map +1 -0
- package/dist/common/sqs/sqs.example.service.d.ts +27 -0
- package/dist/common/sqs/sqs.example.service.js +206 -0
- package/dist/common/sqs/sqs.example.service.js.map +1 -0
- package/dist/common/sqs/sqs.module.d.ts +2 -0
- package/dist/common/sqs/sqs.module.js +24 -0
- package/dist/common/sqs/sqs.module.js.map +1 -0
- package/dist/common/sqs/sqs.producer.d.ts +13 -0
- package/dist/common/sqs/sqs.producer.js +197 -0
- package/dist/common/sqs/sqs.producer.js.map +1 -0
- package/dist/common/websocket/websocket.gateway.d.ts +9 -0
- package/dist/common/websocket/websocket.gateway.js +41 -0
- package/dist/common/websocket/websocket.gateway.js.map +1 -0
- package/dist/common/websocket/websocket.module.d.ts +2 -0
- package/dist/common/websocket/websocket.module.js +22 -0
- package/dist/common/websocket/websocket.module.js.map +1 -0
- package/dist/common/websocket/websocket.service.d.ts +25 -0
- package/dist/common/websocket/websocket.service.js +248 -0
- package/dist/common/websocket/websocket.service.js.map +1 -0
- package/dist/data/data.d.ts +10 -0
- package/dist/data/data.js +10 -0
- package/dist/data/data.js.map +1 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.js +48 -0
- package/dist/main.js.map +1 -0
- package/dist/products/entities/product.entity.d.ts +56 -0
- package/dist/products/entities/product.entity.js +80 -0
- package/dist/products/entities/product.entity.js.map +1 -0
- package/dist/products/products.controller.d.ts +35 -0
- package/dist/products/products.controller.js +98 -0
- package/dist/products/products.controller.js.map +1 -0
- package/dist/products/products.module.d.ts +2 -0
- package/dist/products/products.module.js +27 -0
- package/dist/products/products.module.js.map +1 -0
- package/dist/products/products.service.d.ts +36 -0
- package/dist/products/products.service.example.d.ts +1 -0
- package/dist/products/products.service.example.js +3 -0
- package/dist/products/products.service.example.js.map +1 -0
- package/dist/products/products.service.js +74 -0
- package/dist/products/products.service.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +106 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.ProductsModule = void 0;
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
const products_service_1 = require("./products.service");
|
|
12
|
+
const products_controller_1 = require("./products.controller");
|
|
13
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
14
|
+
const product_entity_1 = require("./entities/product.entity");
|
|
15
|
+
let ProductsModule = class ProductsModule {
|
|
16
|
+
};
|
|
17
|
+
exports.ProductsModule = ProductsModule;
|
|
18
|
+
exports.ProductsModule = ProductsModule = __decorate([
|
|
19
|
+
(0, common_1.Module)({
|
|
20
|
+
imports: [
|
|
21
|
+
mongoose_1.MongooseModule.forFeature([{ name: product_entity_1.Product.name, schema: product_entity_1.ProductSchema }]),
|
|
22
|
+
],
|
|
23
|
+
controllers: [products_controller_1.ProductsController],
|
|
24
|
+
providers: [products_service_1.ProductsService],
|
|
25
|
+
})
|
|
26
|
+
], ProductsModule);
|
|
27
|
+
//# sourceMappingURL=products.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"products.module.js","sourceRoot":"","sources":["../../src/products/products.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,yDAAqD;AACrD,+DAA2D;AAC3D,+CAAkD;AAClD,8DAAmE;AAS5D,IAAM,cAAc,GAApB,MAAM,cAAc;CAAG,CAAA;AAAjB,wCAAc;yBAAd,cAAc;IAP1B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,yBAAc,CAAC,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,wBAAO,CAAC,IAAI,EAAE,MAAM,EAAE,8BAAa,EAAE,CAAC,CAAC;SAC3E;QACD,WAAW,EAAE,CAAC,wCAAkB,CAAC;QACjC,SAAS,EAAE,CAAC,kCAAe,CAAC;KAC7B,CAAC;GACW,cAAc,CAAG"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Product } from './entities/product.entity';
|
|
2
|
+
import mongoose, { Connection, Model } from 'mongoose';
|
|
3
|
+
export declare class ProductsService {
|
|
4
|
+
private prModel;
|
|
5
|
+
private connection;
|
|
6
|
+
constructor(prModel: Model<Product>, connection: Connection);
|
|
7
|
+
create(createProductDto: Product): Promise<mongoose.Document<unknown, {}, Product, {}, mongoose.DefaultSchemaOptions> & Product & {
|
|
8
|
+
_id: mongoose.Types.ObjectId;
|
|
9
|
+
} & {
|
|
10
|
+
__v: number;
|
|
11
|
+
}>;
|
|
12
|
+
findAll(): mongoose.Query<(mongoose.Document<unknown, {}, Product, {}, mongoose.DefaultSchemaOptions> & Product & {
|
|
13
|
+
_id: mongoose.Types.ObjectId;
|
|
14
|
+
} & {
|
|
15
|
+
__v: number;
|
|
16
|
+
})[], mongoose.Document<unknown, {}, Product, {}, mongoose.DefaultSchemaOptions> & Product & {
|
|
17
|
+
_id: mongoose.Types.ObjectId;
|
|
18
|
+
} & {
|
|
19
|
+
__v: number;
|
|
20
|
+
}, {}, Product, "find", {}>;
|
|
21
|
+
findOne(id: number): Promise<mongoose.Document<unknown, {}, Product, {}, mongoose.DefaultSchemaOptions> & Product & {
|
|
22
|
+
_id: mongoose.Types.ObjectId;
|
|
23
|
+
} & {
|
|
24
|
+
__v: number;
|
|
25
|
+
}>;
|
|
26
|
+
update(id: number, product: Product): Promise<mongoose.Document<unknown, {}, Product, {}, mongoose.DefaultSchemaOptions> & Product & {
|
|
27
|
+
_id: mongoose.Types.ObjectId;
|
|
28
|
+
} & {
|
|
29
|
+
__v: number;
|
|
30
|
+
}>;
|
|
31
|
+
remove(id: number): Promise<mongoose.Document<unknown, {}, Product, {}, mongoose.DefaultSchemaOptions> & Product & {
|
|
32
|
+
_id: mongoose.Types.ObjectId;
|
|
33
|
+
} & {
|
|
34
|
+
__v: number;
|
|
35
|
+
}>;
|
|
36
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"products.service.example.js","sourceRoot":"","sources":["../../src/products/products.service.example.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.ProductsService = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
18
|
+
const product_entity_1 = require("./entities/product.entity");
|
|
19
|
+
const mongoose_2 = require("mongoose");
|
|
20
|
+
let ProductsService = class ProductsService {
|
|
21
|
+
prModel;
|
|
22
|
+
connection;
|
|
23
|
+
constructor(prModel, connection) {
|
|
24
|
+
this.prModel = prModel;
|
|
25
|
+
this.connection = connection;
|
|
26
|
+
}
|
|
27
|
+
async create(createProductDto) {
|
|
28
|
+
const existingProduct = await this.prModel
|
|
29
|
+
.findOne({ id: createProductDto.id })
|
|
30
|
+
.exec();
|
|
31
|
+
if (existingProduct) {
|
|
32
|
+
throw new common_1.ConflictException(`Producto con id ${createProductDto.id} ya existe`);
|
|
33
|
+
}
|
|
34
|
+
const createdCat = new this.prModel(createProductDto);
|
|
35
|
+
return createdCat.save();
|
|
36
|
+
}
|
|
37
|
+
findAll() {
|
|
38
|
+
return this.prModel.find();
|
|
39
|
+
}
|
|
40
|
+
async findOne(id) {
|
|
41
|
+
const product = await this.prModel.findOne({ id: id }).exec();
|
|
42
|
+
if (!product) {
|
|
43
|
+
throw new common_1.NotFoundException(`Producto con id ${id} no encontrado`);
|
|
44
|
+
}
|
|
45
|
+
return product;
|
|
46
|
+
}
|
|
47
|
+
async update(id, product) {
|
|
48
|
+
const updatedProduct = await this.prModel
|
|
49
|
+
.findOneAndUpdate({ id: id }, product, { new: true })
|
|
50
|
+
.exec();
|
|
51
|
+
if (!updatedProduct) {
|
|
52
|
+
throw new common_1.NotFoundException(`Producto con id ${id} no encontrado`);
|
|
53
|
+
}
|
|
54
|
+
return updatedProduct;
|
|
55
|
+
}
|
|
56
|
+
async remove(id) {
|
|
57
|
+
const deletedProduct = await this.prModel
|
|
58
|
+
.findOneAndDelete({ id: id })
|
|
59
|
+
.exec();
|
|
60
|
+
if (!deletedProduct) {
|
|
61
|
+
throw new common_1.NotFoundException(`Producto con id ${id} no encontrado`);
|
|
62
|
+
}
|
|
63
|
+
return deletedProduct;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
exports.ProductsService = ProductsService;
|
|
67
|
+
exports.ProductsService = ProductsService = __decorate([
|
|
68
|
+
(0, common_1.Injectable)(),
|
|
69
|
+
__param(0, (0, mongoose_1.InjectModel)(product_entity_1.Product.name)),
|
|
70
|
+
__param(1, (0, mongoose_1.InjectConnection)()),
|
|
71
|
+
__metadata("design:paramtypes", [mongoose_2.Model,
|
|
72
|
+
mongoose_2.Connection])
|
|
73
|
+
], ProductsService);
|
|
74
|
+
//# sourceMappingURL=products.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"products.service.js","sourceRoot":"","sources":["../../src/products/products.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAkF;AAClF,+CAAiE;AACjE,8DAAoD;AACpD,uCAAuD;AAGhD,IAAM,eAAe,GAArB,MAAM,eAAe;IAEW;IACP;IAF9B,YACqC,OAAuB,EAC9B,UAAsB;QADf,YAAO,GAAP,OAAO,CAAgB;QAC9B,eAAU,GAAV,UAAU,CAAY;IACjD,CAAC;IAEJ,KAAK,CAAC,MAAM,CAAC,gBAAyB;QACpC,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,OAAO;aACvC,OAAO,CAAC,EAAE,EAAE,EAAE,gBAAgB,CAAC,EAAE,EAAE,CAAC;aACpC,IAAI,EAAE,CAAC;QAEV,IAAI,eAAe,EAAE,CAAC;YACpB,MAAM,IAAI,0BAAiB,CACzB,mBAAmB,gBAAgB,CAAC,EAAE,YAAY,CACnD,CAAC;QACJ,CAAC;QAED,MAAM,UAAU,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;QACtD,OAAO,UAAU,CAAC,IAAI,EAAE,CAAC;IAC3B,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;IAC7B,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,EAAU;QACtB,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QAE9D,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,0BAAiB,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,CAAC;QACrE,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,OAAgB;QACvC,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,OAAO;aACtC,gBAAgB,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;aACpD,IAAI,EAAE,CAAC;QAEV,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,MAAM,IAAI,0BAAiB,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,CAAC;QACrE,CAAC;QAED,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAU;QACrB,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,OAAO;aACtC,gBAAgB,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;aAC5B,IAAI,EAAE,CAAC;QAEV,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,MAAM,IAAI,0BAAiB,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,CAAC;QACrE,CAAC;QAED,OAAO,cAAc,CAAC;IACxB,CAAC;CACF,CAAA;AA1DY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,sBAAW,EAAC,wBAAO,CAAC,IAAI,CAAC,CAAA;IACzB,WAAA,IAAA,2BAAgB,GAAE,CAAA;qCADyB,gBAAK;QACT,qBAAU;GAHzC,eAAe,CA0D3B"}
|