Add global admin checks list and deepen check notification links.
Expose GET /admin/checks with order context, and point admin check alerts to the per-order checks page. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Vendored
+22
@@ -14,6 +14,7 @@ const common_1 = require("@nestjs/common");
|
||||
const client_1 = require("@prisma/client");
|
||||
const prisma_service_1 = require("../prisma/prisma.service");
|
||||
const notifications_service_1 = require("../notifications/notifications.service");
|
||||
const name_1 = require("../common/utils/name");
|
||||
let ChecksService = class ChecksService {
|
||||
prisma;
|
||||
notifications;
|
||||
@@ -33,6 +34,27 @@ let ChecksService = class ChecksService {
|
||||
});
|
||||
return checks.map((c) => this.map(c));
|
||||
}
|
||||
async findAll(status) {
|
||||
const where = status && Object.values(client_1.CheckStatus).includes(status)
|
||||
? { status: status }
|
||||
: {};
|
||||
const checks = await this.prisma.check.findMany({
|
||||
where,
|
||||
include: {
|
||||
order: {
|
||||
include: { user: true },
|
||||
},
|
||||
},
|
||||
orderBy: [{ dueDate: 'asc' }, { createdAt: 'desc' }],
|
||||
});
|
||||
return checks.map((c) => ({
|
||||
...this.map(c),
|
||||
orderNumber: c.order.orderNumber,
|
||||
customerName: (0, name_1.joinFullName)(c.order.user.firstName, c.order.user.lastName),
|
||||
orderStatus: c.order.status,
|
||||
settlementType: c.order.settlementType,
|
||||
}));
|
||||
}
|
||||
async updateStatus(id, adminId, dto) {
|
||||
const check = await this.prisma.check.findUnique({
|
||||
where: { id },
|
||||
|
||||
Reference in New Issue
Block a user