Refactor payment storage to remove unnecessary status assignment and include creation timestamp
This commit is contained in:
parent
bad88f2016
commit
d28c9897da
@ -4,7 +4,6 @@ import { InjectRepository } from '@nestjs/typeorm';
|
|||||||
import { Payment } from '../entities/payment.entity';
|
import { Payment } from '../entities/payment.entity';
|
||||||
import { Repository } from 'typeorm';
|
import { Repository } from 'typeorm';
|
||||||
import { QueueService } from '../../queue/queue.service';
|
import { QueueService } from '../../queue/queue.service';
|
||||||
import { PaymentStatusEnum } from '../enumns/payment-status.enum';
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class PaymentsService {
|
export class PaymentsService {
|
||||||
@ -16,14 +15,9 @@ export class PaymentsService {
|
|||||||
) {}
|
) {}
|
||||||
|
|
||||||
async store(createPaymentDto: CreatePaymentDto) {
|
async store(createPaymentDto: CreatePaymentDto) {
|
||||||
const payment = await this.repository.save({
|
|
||||||
...createPaymentDto,
|
|
||||||
status: PaymentStatusEnum.PENDING,
|
|
||||||
});
|
|
||||||
|
|
||||||
await this.queueService.addPaymentJob({
|
await this.queueService.addPaymentJob({
|
||||||
paymentId: payment.id,
|
|
||||||
paymentData: createPaymentDto,
|
paymentData: createPaymentDto,
|
||||||
|
createdAt: new Date(),
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user