metricas en baja de repeticiones
This commit is contained in:
@@ -157,7 +157,10 @@ export class MetricsAdapterMongoose implements IMetricsAdapter {
|
||||
if (!metrics.repeatsCount) {
|
||||
metrics.repeatsCount = 0;
|
||||
}
|
||||
metrics.repeatsCount += isNull<number>(data.quantity, 1);
|
||||
metrics.repeatsCount = Math.max(
|
||||
0,
|
||||
isNull<number>(metrics.repeatsCount, 0) + isNull<number>(data.quantity, 1)
|
||||
);
|
||||
await metrics.save();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ export interface IMetricsAdapter {
|
||||
addService(data: MetricsParams): Promise<void>;
|
||||
addAppointment(data: MetricsParams): Promise<void>;
|
||||
addClient(data: MetricsParams): Promise<void>;
|
||||
addRepeat(data: MetricsParams): Promise<void>;
|
||||
}
|
||||
|
||||
export interface IMetricsManager {
|
||||
@@ -50,6 +51,7 @@ export interface IMetricsManager {
|
||||
reserveAppointment(data: MetricsParams): Promise<boolean>;
|
||||
releaseAppointment(data: MetricsParams): Promise<void>;
|
||||
addClient(data: MetricsParams): Promise<void>;
|
||||
addRepeat(data: MetricsParams): Promise<void>;
|
||||
canAddOrganization(userId: string): Promise<boolean>;
|
||||
canAddEmployee(userId: string): Promise<boolean>;
|
||||
canAddService(userId: string): Promise<boolean>;
|
||||
|
||||
Reference in New Issue
Block a user