fix: enforce drainage uniqueness and carrier-specific reporting

This commit is contained in:
hectorzhao
2026-09-14 18:12:38 +08:00
parent ac6449028c
commit 7f9abe3da0
26 changed files with 2637 additions and 965 deletions
@@ -370,6 +370,7 @@ describe('ChannelsService', () => {
updatedAt: new Date(),
};
const tx = {
$executeRaw: jest.fn().mockResolvedValue(1),
channelReportField: {
findMany: jest
.fn()
@@ -519,6 +520,7 @@ describe('ChannelsService', () => {
async (sourceEntry) => {
const prisma = createPrismaMock();
const tx = {
$executeRaw: jest.fn().mockResolvedValue(1),
smsSignature: {
findUnique: jest.fn().mockResolvedValue({ id: 'sig-1', tenantId: 'tenant-1', applicationId: 'app-1' }),
update: jest.fn().mockResolvedValue({ id: 'sig-1', reportStatus: 'approved' }),
@@ -601,6 +603,7 @@ describe('ChannelsService', () => {
it('uses the enterprise-signature save time when creating an approved carrier task', async () => {
const prisma = createPrismaMock();
const tx = {
$executeRaw: jest.fn().mockResolvedValue(1),
smsSignature: {
findUnique: jest.fn().mockResolvedValue({ id: 'sig-1', tenantId: 'tenant-1', applicationId: 'app-1' }),
update: jest.fn().mockResolvedValue({ id: 'sig-1', reportStatus: 'approved' }),
@@ -655,6 +658,7 @@ describe('ChannelsService', () => {
it('changes a drainage report task without overwriting the signature report summary', async () => {
const prisma = createPrismaMock();
const tx = {
$executeRaw: jest.fn().mockResolvedValue(1),
smsSignature: {
findUnique: jest.fn().mockResolvedValue({ id: 'sig-1', tenantId: 'tenant-1', applicationId: 'app-1' }),
update: jest.fn(),
@@ -699,6 +703,7 @@ describe('ChannelsService', () => {
reportType: 'drainage',
drainageItemId: 'drain-1',
channelId: 'channel-1',
carrier: null,
status: 'approved',
},
]);
@@ -1259,6 +1264,7 @@ describe('ChannelsService', () => {
const transactionCallback = prisma.$transaction.mock.calls[0][0];
const tx = {
$executeRaw: jest.fn().mockResolvedValue(1),
smsChannelGroupItem: { deleteMany: jest.fn(), createMany: jest.fn() },
smsChannelGroup: {
update: jest.fn(),