common-tg-service 1.0.28 → 1.0.30
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/dist/components/transactions/schemas/transaction.schema.d.ts +3 -0
- package/dist/components/transactions/schemas/transaction.schema.js +26 -12
- package/dist/components/transactions/schemas/transaction.schema.js.map +1 -1
- package/dist/components/transactions/transaction.service.js +26 -3
- package/dist/components/transactions/transaction.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -35,6 +35,9 @@ export declare class Transaction {
|
|
|
35
35
|
chatId: string;
|
|
36
36
|
ip: string;
|
|
37
37
|
status: string;
|
|
38
|
+
isDeleted: boolean;
|
|
39
|
+
createdAt?: Date;
|
|
40
|
+
updatedAt?: Date;
|
|
38
41
|
}
|
|
39
42
|
export declare const TransactionSchema: import("mongoose").Schema<Transaction, import("mongoose").Model<Transaction, any, any, any, Document<unknown, any, Transaction> & Transaction & {
|
|
40
43
|
_id: import("mongoose").Types.ObjectId;
|
|
@@ -15,51 +15,65 @@ let Transaction = class Transaction {
|
|
|
15
15
|
};
|
|
16
16
|
exports.Transaction = Transaction;
|
|
17
17
|
__decorate([
|
|
18
|
-
(0, mongoose_1.Prop)({ required:
|
|
18
|
+
(0, mongoose_1.Prop)({ type: String, required: true, unique: true, index: true }),
|
|
19
19
|
__metadata("design:type", String)
|
|
20
20
|
], Transaction.prototype, "transactionId", void 0);
|
|
21
21
|
__decorate([
|
|
22
|
-
(0, mongoose_1.Prop)({ required:
|
|
22
|
+
(0, mongoose_1.Prop)({ type: Number, required: true }),
|
|
23
23
|
__metadata("design:type", Number)
|
|
24
24
|
], Transaction.prototype, "amount", void 0);
|
|
25
25
|
__decorate([
|
|
26
|
-
(0, mongoose_1.Prop)({ required:
|
|
26
|
+
(0, mongoose_1.Prop)({ type: String, required: true }),
|
|
27
27
|
__metadata("design:type", String)
|
|
28
28
|
], Transaction.prototype, "issue", void 0);
|
|
29
29
|
__decorate([
|
|
30
|
-
(0, mongoose_1.Prop)({
|
|
30
|
+
(0, mongoose_1.Prop)({ type: String, default: '' }),
|
|
31
31
|
__metadata("design:type", String)
|
|
32
32
|
], Transaction.prototype, "description", void 0);
|
|
33
33
|
__decorate([
|
|
34
|
-
(0, mongoose_1.Prop)({
|
|
34
|
+
(0, mongoose_1.Prop)({ type: String }),
|
|
35
35
|
__metadata("design:type", String)
|
|
36
36
|
], Transaction.prototype, "refundMethod", void 0);
|
|
37
37
|
__decorate([
|
|
38
|
-
(0, mongoose_1.Prop)({
|
|
38
|
+
(0, mongoose_1.Prop)({ type: String, default: 'undefined' }),
|
|
39
39
|
__metadata("design:type", String)
|
|
40
40
|
], Transaction.prototype, "profile", void 0);
|
|
41
41
|
__decorate([
|
|
42
|
-
(0, mongoose_1.Prop)({
|
|
42
|
+
(0, mongoose_1.Prop)({ type: String, default: 'undefined' }),
|
|
43
43
|
__metadata("design:type", String)
|
|
44
44
|
], Transaction.prototype, "chatId", void 0);
|
|
45
45
|
__decorate([
|
|
46
|
-
(0, mongoose_1.Prop)({
|
|
46
|
+
(0, mongoose_1.Prop)({ type: String, default: 'undefined' }),
|
|
47
47
|
__metadata("design:type", String)
|
|
48
48
|
], Transaction.prototype, "ip", void 0);
|
|
49
49
|
__decorate([
|
|
50
|
-
(0, mongoose_1.Prop)({
|
|
50
|
+
(0, mongoose_1.Prop)({
|
|
51
|
+
type: String,
|
|
52
|
+
enum: ['pending', 'completed', 'failed', 'cancelled'],
|
|
53
|
+
default: 'pending'
|
|
54
|
+
}),
|
|
51
55
|
__metadata("design:type", String)
|
|
52
56
|
], Transaction.prototype, "status", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, mongoose_1.Prop)({ type: Boolean, default: false }),
|
|
59
|
+
__metadata("design:type", Boolean)
|
|
60
|
+
], Transaction.prototype, "isDeleted", void 0);
|
|
53
61
|
exports.Transaction = Transaction = __decorate([
|
|
54
|
-
(0, mongoose_1.Schema)({
|
|
62
|
+
(0, mongoose_1.Schema)({
|
|
55
63
|
timestamps: true,
|
|
64
|
+
collection: 'transactions',
|
|
56
65
|
toJSON: {
|
|
57
66
|
virtuals: true,
|
|
58
|
-
transform: (
|
|
59
|
-
delete ret.
|
|
67
|
+
transform: (_doc, ret) => {
|
|
68
|
+
delete ret.__v;
|
|
69
|
+
return ret;
|
|
60
70
|
},
|
|
61
71
|
},
|
|
72
|
+
strict: false
|
|
62
73
|
})
|
|
63
74
|
], Transaction);
|
|
64
75
|
exports.TransactionSchema = mongoose_1.SchemaFactory.createForClass(Transaction);
|
|
76
|
+
exports.TransactionSchema.index({ createdAt: 1 });
|
|
77
|
+
exports.TransactionSchema.index({ chatId: 1 });
|
|
78
|
+
exports.TransactionSchema.index({ status: 1 });
|
|
65
79
|
//# sourceMappingURL=transaction.schema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.schema.js","sourceRoot":"","sources":["../../../../src/components/transactions/schemas/transaction.schema.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAA+D;
|
|
1
|
+
{"version":3,"file":"transaction.schema.js","sourceRoot":"","sources":["../../../../src/components/transactions/schemas/transaction.schema.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAA+D;AAiBxD,IAAM,WAAW,GAAjB,MAAM,WAAW;CAqCvB,CAAA;AArCY,kCAAW;AAEtB;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;;kDAC5C;AAGtB;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CACxB;AAGf;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CACzB;AAGd;IADC,IAAA,eAAI,EA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,CAAC,CAAC;AACvC,yBAAiB,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC"}
|
|
@@ -22,9 +22,32 @@ let TransactionService = class TransactionService {
|
|
|
22
22
|
this.transactionModel = transactionModel;
|
|
23
23
|
}
|
|
24
24
|
async create(createTransactionDto) {
|
|
25
|
-
console.log('
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
console.log('Creating new transaction with data:', createTransactionDto);
|
|
26
|
+
try {
|
|
27
|
+
const transactionData = {
|
|
28
|
+
transactionId: createTransactionDto.transactionId,
|
|
29
|
+
amount: createTransactionDto.amount,
|
|
30
|
+
issue: createTransactionDto.issue,
|
|
31
|
+
description: createTransactionDto.description || '',
|
|
32
|
+
refundMethod: createTransactionDto.refundMethod,
|
|
33
|
+
profile: createTransactionDto.profile || 'undefined',
|
|
34
|
+
chatId: createTransactionDto.chatId || 'undefined',
|
|
35
|
+
ip: createTransactionDto.ip || 'undefined',
|
|
36
|
+
status: createTransactionDto.status || 'pending',
|
|
37
|
+
isDeleted: false
|
|
38
|
+
};
|
|
39
|
+
console.log('Prepared transaction data:', transactionData);
|
|
40
|
+
const newTransaction = new this.transactionModel(transactionData);
|
|
41
|
+
console.log('Transaction model created:', newTransaction.toObject());
|
|
42
|
+
const savedTransaction = await newTransaction.save();
|
|
43
|
+
console.log('Transaction saved successfully:', savedTransaction.toObject());
|
|
44
|
+
return savedTransaction;
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
console.error('Error saving transaction:', error);
|
|
48
|
+
console.error('Transaction data that failed:', createTransactionDto);
|
|
49
|
+
throw error;
|
|
50
|
+
}
|
|
28
51
|
}
|
|
29
52
|
async findOne(id) {
|
|
30
53
|
const transaction = await this.transactionModel.findById(id).exec();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.service.js","sourceRoot":"","sources":["../../../src/components/transactions/transaction.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA+D;AAC/D,+CAA+C;AAC/C,uCAAiC;AAGjC,qEAAgF;AAGzE,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAC7B,YACkD,gBAA4C;QAA5C,qBAAgB,GAAhB,gBAAgB,CAA4B;IAC3F,CAAC;IAEJ,KAAK,CAAC,MAAM,CAAC,oBAA0C;QACrD,OAAO,CAAC,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"transaction.service.js","sourceRoot":"","sources":["../../../src/components/transactions/transaction.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA+D;AAC/D,+CAA+C;AAC/C,uCAAiC;AAGjC,qEAAgF;AAGzE,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAC7B,YACkD,gBAA4C;QAA5C,qBAAgB,GAAhB,gBAAgB,CAA4B;IAC3F,CAAC;IAEJ,KAAK,CAAC,MAAM,CAAC,oBAA0C;QACrD,OAAO,CAAC,GAAG,CAAC,qCAAqC,EAAE,oBAAoB,CAAC,CAAC;QAEzE,IAAI,CAAC;YACH,MAAM,eAAe,GAAG;gBACtB,aAAa,EAAE,oBAAoB,CAAC,aAAa;gBACjD,MAAM,EAAE,oBAAoB,CAAC,MAAM;gBACnC,KAAK,EAAE,oBAAoB,CAAC,KAAK;gBACjC,WAAW,EAAE,oBAAoB,CAAC,WAAW,IAAI,EAAE;gBACnD,YAAY,EAAE,oBAAoB,CAAC,YAAY;gBAC/C,OAAO,EAAE,oBAAoB,CAAC,OAAO,IAAI,WAAW;gBACpD,MAAM,EAAE,oBAAoB,CAAC,MAAM,IAAI,WAAW;gBAClD,EAAE,EAAE,oBAAoB,CAAC,EAAE,IAAI,WAAW;gBAC1C,MAAM,EAAE,oBAAoB,CAAC,MAAM,IAAI,SAAS;gBAChD,SAAS,EAAE,KAAK;aACjB,CAAC;YAEF,OAAO,CAAC,GAAG,CAAC,4BAA4B,EAAE,eAAe,CAAC,CAAC;YAE3D,MAAM,cAAc,GAAG,IAAI,IAA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