mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 21:08:12 +00:00
per-user trade-direction access scope
This commit is contained in:
@@ -40,7 +40,10 @@ export class OverviewService {
|
||||
return { bookingsByPipeline, bookingsByStatus };
|
||||
}
|
||||
|
||||
async getDashboard(range: OverviewRangeQuery = '30d'): Promise<OverviewResponseDto> {
|
||||
async getDashboard(
|
||||
range: OverviewRangeQuery = '30d',
|
||||
dirs?: string[],
|
||||
): Promise<OverviewResponseDto> {
|
||||
const days = OVERVIEW_RANGE_DAYS[range];
|
||||
|
||||
const [
|
||||
@@ -55,16 +58,16 @@ export class OverviewService {
|
||||
paymentTrend,
|
||||
recentBookings,
|
||||
] = await Promise.all([
|
||||
this.overviewRepository.getBookingKpis(),
|
||||
this.overviewRepository.getContractKpis(),
|
||||
this.overviewRepository.getBookingKpis(dirs),
|
||||
this.overviewRepository.getContractKpis(dirs),
|
||||
this.overviewRepository.getOperationsKpis(),
|
||||
this.overviewRepository.getCustomerKpis(),
|
||||
this.overviewRepository.getBillingKpis(),
|
||||
this.overviewRepository.getBillingKpis(dirs),
|
||||
this.overviewRepository.getStaffKpis(),
|
||||
this.overviewRepository.getBookingTrend(days),
|
||||
this.overviewRepository.getStatusCounts(),
|
||||
this.overviewRepository.getPaymentTrend(days),
|
||||
this.overviewRepository.getRecentBookings(8),
|
||||
this.overviewRepository.getBookingTrend(days, dirs),
|
||||
this.overviewRepository.getStatusCounts(dirs),
|
||||
this.overviewRepository.getPaymentTrend(days, dirs),
|
||||
this.overviewRepository.getRecentBookings(8, dirs),
|
||||
]);
|
||||
|
||||
const { bookingsByPipeline, bookingsByStatus } =
|
||||
@@ -91,7 +94,10 @@ export class OverviewService {
|
||||
};
|
||||
}
|
||||
|
||||
async getBookingsTab(range: OverviewRangeQuery = '30d'): Promise<OverviewBookingsTabDto> {
|
||||
async getBookingsTab(
|
||||
range: OverviewRangeQuery = '30d',
|
||||
dirs?: string[],
|
||||
): Promise<OverviewBookingsTabDto> {
|
||||
const days = OVERVIEW_RANGE_DAYS[range];
|
||||
|
||||
const [
|
||||
@@ -102,12 +108,12 @@ export class OverviewService {
|
||||
bookingsByCurrency,
|
||||
recentBookings,
|
||||
] = await Promise.all([
|
||||
this.overviewRepository.getBookingKpis(),
|
||||
this.overviewRepository.getBookingTrend(days),
|
||||
this.overviewRepository.getStatusCounts(),
|
||||
this.overviewRepository.getBookingsByFreightType(),
|
||||
this.overviewRepository.getBookingsByCurrency(),
|
||||
this.overviewRepository.getRecentBookings(8),
|
||||
this.overviewRepository.getBookingKpis(dirs),
|
||||
this.overviewRepository.getBookingTrend(days, dirs),
|
||||
this.overviewRepository.getStatusCounts(dirs),
|
||||
this.overviewRepository.getBookingsByFreightType(dirs),
|
||||
this.overviewRepository.getBookingsByCurrency(dirs),
|
||||
this.overviewRepository.getRecentBookings(8, dirs),
|
||||
]);
|
||||
|
||||
const { bookingsByPipeline, bookingsByStatus } =
|
||||
@@ -130,6 +136,7 @@ export class OverviewService {
|
||||
|
||||
async getContractsTab(
|
||||
range: OverviewRangeQuery = '30d',
|
||||
dirs?: string[],
|
||||
): Promise<OverviewContractsTabDto> {
|
||||
const days = OVERVIEW_RANGE_DAYS[range];
|
||||
|
||||
@@ -141,12 +148,12 @@ export class OverviewService {
|
||||
contractsByFreightType,
|
||||
recentContracts,
|
||||
] = await Promise.all([
|
||||
this.overviewRepository.getContractKpis(),
|
||||
this.overviewRepository.getContractTrend(days),
|
||||
this.overviewRepository.getContractStatusCounts(),
|
||||
this.overviewRepository.getContractsByKind(),
|
||||
this.overviewRepository.getContractsByFreightType(),
|
||||
this.overviewRepository.getRecentContracts(8),
|
||||
this.overviewRepository.getContractKpis(dirs),
|
||||
this.overviewRepository.getContractTrend(days, dirs),
|
||||
this.overviewRepository.getContractStatusCounts(dirs),
|
||||
this.overviewRepository.getContractsByKind(dirs),
|
||||
this.overviewRepository.getContractsByFreightType(dirs),
|
||||
this.overviewRepository.getRecentContracts(8, dirs),
|
||||
]);
|
||||
|
||||
const contractsByStatus = Object.entries(statusCounts)
|
||||
@@ -170,16 +177,19 @@ export class OverviewService {
|
||||
};
|
||||
}
|
||||
|
||||
async getBillingTab(range: OverviewRangeQuery = '30d'): Promise<OverviewBillingTabDto> {
|
||||
async getBillingTab(
|
||||
range: OverviewRangeQuery = '30d',
|
||||
dirs?: string[],
|
||||
): Promise<OverviewBillingTabDto> {
|
||||
const days = OVERVIEW_RANGE_DAYS[range];
|
||||
|
||||
const [kpis, paymentTrend, paymentsByStatus, paymentsByMethod, revenueByCurrency] =
|
||||
await Promise.all([
|
||||
this.overviewRepository.getBillingKpis(),
|
||||
this.overviewRepository.getPaymentTrend(days),
|
||||
this.overviewRepository.getPaymentsByStatus(),
|
||||
this.overviewRepository.getPaymentsByMethod(),
|
||||
this.overviewRepository.getRevenueByCurrency(),
|
||||
this.overviewRepository.getBillingKpis(dirs),
|
||||
this.overviewRepository.getPaymentTrend(days, dirs),
|
||||
this.overviewRepository.getPaymentsByStatus(dirs),
|
||||
this.overviewRepository.getPaymentsByMethod(dirs),
|
||||
this.overviewRepository.getRevenueByCurrency(dirs),
|
||||
]);
|
||||
|
||||
return {
|
||||
@@ -217,7 +227,10 @@ export class OverviewService {
|
||||
};
|
||||
}
|
||||
|
||||
async getCustomersTab(range: OverviewRangeQuery = '30d'): Promise<OverviewCustomersTabDto> {
|
||||
async getCustomersTab(
|
||||
range: OverviewRangeQuery = '30d',
|
||||
dirs?: string[],
|
||||
): Promise<OverviewCustomersTabDto> {
|
||||
const days = OVERVIEW_RANGE_DAYS[range];
|
||||
|
||||
const [kpis, customerGrowthTrend, customersByType, topCustomersByBookings] =
|
||||
@@ -225,7 +238,7 @@ export class OverviewService {
|
||||
this.overviewRepository.getCustomerKpis(),
|
||||
this.overviewRepository.getCustomerGrowthTrend(days),
|
||||
this.overviewRepository.getCustomersByType(),
|
||||
this.overviewRepository.getTopCustomersByBookings(8),
|
||||
this.overviewRepository.getTopCustomersByBookings(8, dirs),
|
||||
]);
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user