fix: close sms scheduling and billing gaps
This commit is contained in:
@@ -72,7 +72,7 @@ export class OperationsService {
|
||||
|
||||
async dashboard(query: { tenantId?: string }) {
|
||||
const messageWhereClause = messageWhere({ tenantId: query.tenantId });
|
||||
const [taskCount, messageGroups, uplinkCount, billingAggregate, transactionAggregate] = await Promise.all([
|
||||
const [taskCount, messageGroups, uplinkCount, billingAggregate, transactionAggregate, connectionGroups] = await Promise.all([
|
||||
this.prisma.smsBatchTask.count({ where: { tenantId: query.tenantId } }),
|
||||
this.prisma.smsMessageRecord.groupBy({
|
||||
by: ['status'],
|
||||
@@ -91,6 +91,12 @@ export class OperationsService {
|
||||
_sum: { amountCents: true, smsUnits: true },
|
||||
_count: { _all: true },
|
||||
}),
|
||||
this.prisma.cmppConnectionState.groupBy({
|
||||
by: ['status'],
|
||||
where: { tenantId: query.tenantId },
|
||||
_count: { _all: true },
|
||||
_sum: { currentConnections: true, desiredConnections: true },
|
||||
}),
|
||||
]);
|
||||
return {
|
||||
taskCount,
|
||||
@@ -98,6 +104,7 @@ export class OperationsService {
|
||||
uplinkCount,
|
||||
billing: billingAggregate,
|
||||
transactions: transactionAggregate,
|
||||
gatewayConnections: connectionGroups,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -238,4 +245,3 @@ function normalizeGroupBy(groupBy?: string) {
|
||||
}
|
||||
return 'channelId';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user