61 lines
2.0 KiB
TypeScript
61 lines
2.0 KiB
TypeScript
import { IMetricsDocument } from "./Metrics.Adapter.Mongoose";
|
|
|
|
export type MetricsParams = {
|
|
userId?: string;
|
|
companyId?: string;
|
|
quantity?: number;
|
|
limit?: number;
|
|
};
|
|
|
|
export type DeleteMetricsByCompany = {
|
|
companyId: string;
|
|
};
|
|
|
|
export type CalculateMetricsParams = {
|
|
userId: string;
|
|
};
|
|
|
|
export interface IMetrics {
|
|
id?: string;
|
|
userId: string;
|
|
organizationsCount: number;
|
|
employeesCount: number;
|
|
servicesCount: number;
|
|
appointmentsCount: number;
|
|
clientsCount: number;
|
|
repeatsCount: number;
|
|
month: number;
|
|
year: number;
|
|
}
|
|
|
|
export interface IMetricsAdapter {
|
|
create(userId: string): Promise<IMetricsDocument>;
|
|
reset(userId: string): Promise<IMetricsDocument>;
|
|
getMetrics(userId: string): Promise<IMetricsDocument>;
|
|
addOrganization(data: MetricsParams): Promise<void>;
|
|
addEmployee(data: MetricsParams): Promise<void>;
|
|
addService(data: MetricsParams): Promise<void>;
|
|
addAppointment(data: MetricsParams): Promise<void>;
|
|
addClient(data: MetricsParams): Promise<void>;
|
|
}
|
|
|
|
export interface IMetricsManager {
|
|
metrics: IMetricsAdapter;
|
|
reset(userId: string): Promise<void>;
|
|
getMetrics(userId: string): Promise<IMetricsDocument>;
|
|
addOrganization(data: MetricsParams): Promise<void>;
|
|
addEmployee(data: MetricsParams): Promise<void>;
|
|
addService(data: MetricsParams): Promise<void>;
|
|
addAppointment(data: MetricsParams): Promise<void>;
|
|
reserveAppointment(data: MetricsParams): Promise<boolean>;
|
|
releaseAppointment(data: MetricsParams): Promise<void>;
|
|
addClient(data: MetricsParams): Promise<void>;
|
|
canAddOrganization(userId: string): Promise<boolean>;
|
|
canAddEmployee(userId: string): Promise<boolean>;
|
|
canAddService(userId: string): Promise<boolean>;
|
|
canAddAppointment(userId: string): Promise<boolean>;
|
|
canAddClient(userId: string): Promise<boolean>;
|
|
deleteMetricsByCompany(data: DeleteMetricsByCompany): Promise<void>;
|
|
calculateMetrics(data: CalculateMetricsParams): Promise<void>;
|
|
}
|