first commit
This commit is contained in:
@@ -0,0 +1,298 @@
|
||||
import { TextObjectFilterResult } from "../TextObjectFilter.model";
|
||||
import { ICompanyDocument } from "./Companies.Adapter.Mongoose";
|
||||
|
||||
export enum COMPANY_PUBLISHED_STATUS {
|
||||
PUBLISHED = "published",
|
||||
PRIVATE = "private",
|
||||
}
|
||||
|
||||
export type CreateCompanyParams = {
|
||||
name: string;
|
||||
description: string;
|
||||
categoryId: number;
|
||||
ownerId: string;
|
||||
onboardingStep?: number;
|
||||
};
|
||||
|
||||
export type UpdateCompanyParams = {
|
||||
id: string;
|
||||
name?: string;
|
||||
description?: string;
|
||||
categoryId?: number;
|
||||
headerFile?: string;
|
||||
iconFile?: string;
|
||||
logoFile?: string;
|
||||
headerColor?: string;
|
||||
headerFontColor?: string;
|
||||
headerFontShadowColor?: string;
|
||||
street?: string;
|
||||
streetNumber?: string;
|
||||
builingFloor?: string;
|
||||
buildingApartament?: string;
|
||||
block?: string;
|
||||
city?: string;
|
||||
state?: string;
|
||||
country?: string;
|
||||
zipCode?: string;
|
||||
latitude?: number;
|
||||
longitude?: number;
|
||||
phoneCountryCode?: string;
|
||||
phoneAreaCode?: string;
|
||||
phoneNumber?: string;
|
||||
heatMapFraction?: number;
|
||||
appointmentTime?: number;
|
||||
cancellationTime?: number;
|
||||
wapServerId?: string;
|
||||
appointmentAlert?: string;
|
||||
sessionUser: string;
|
||||
templateWapNotifId?: string;
|
||||
templateWapAltaId?: string;
|
||||
templateEmailNotifId?: string;
|
||||
templateEmailAltaId?: string;
|
||||
onboardingStep?: number;
|
||||
onboardingCompleted?: boolean;
|
||||
banned?: boolean;
|
||||
};
|
||||
|
||||
export type SetCompanyFileParams = {
|
||||
companyId: string;
|
||||
sessionUser: string;
|
||||
file: Express.Multer.File;
|
||||
};
|
||||
|
||||
export type DeleteCompanyFileParams = {
|
||||
companyId: string;
|
||||
sessionUser: string;
|
||||
};
|
||||
|
||||
export type DeleteCompanyParams = {
|
||||
companyId: string;
|
||||
sessionUser: string;
|
||||
};
|
||||
|
||||
export type FindCompaniesParams = {
|
||||
_id?: string;
|
||||
name?: string;
|
||||
slug?: string;
|
||||
categoryId?: number;
|
||||
street?: string;
|
||||
streetNumber?: string;
|
||||
builingFloor?: string;
|
||||
buildingApartament?: string;
|
||||
block?: string;
|
||||
city?: string;
|
||||
state?: string;
|
||||
country?: string;
|
||||
zipCode?: string;
|
||||
latitude?: number;
|
||||
longitude?: number;
|
||||
phoneCountryCode?: string;
|
||||
phoneAreaCode?: string;
|
||||
phoneNumber?: string;
|
||||
heatMapFraction?: number;
|
||||
appointmentTime?: number;
|
||||
cancellationTime?: number;
|
||||
ownerId?: string;
|
||||
wapServerId?: string;
|
||||
};
|
||||
|
||||
export type SetOrganizationPublishedStatusParams = {
|
||||
companyId: string;
|
||||
published: COMPANY_PUBLISHED_STATUS;
|
||||
sessionUser: string;
|
||||
};
|
||||
|
||||
export type SetNotificationAutoParams = {
|
||||
companyId: string;
|
||||
status?: boolean;
|
||||
sessionUser: string;
|
||||
};
|
||||
|
||||
export interface ICompany {
|
||||
id?: string;
|
||||
name: string;
|
||||
slug: string;
|
||||
description: string;
|
||||
categoryId: number;
|
||||
ownerId: string;
|
||||
headerFile?: string;
|
||||
iconFile?: string;
|
||||
logoFile?: string;
|
||||
headerColor?: string;
|
||||
headerFontColor?: string;
|
||||
headerFontShadowColor?: string;
|
||||
street?: string;
|
||||
streetNumber?: string;
|
||||
builingFloor?: string;
|
||||
buildingApartament?: string;
|
||||
block?: string;
|
||||
city?: string;
|
||||
state?: string;
|
||||
country?: string;
|
||||
zipCode?: string;
|
||||
latitude?: number;
|
||||
longitude?: number;
|
||||
phoneCountryCode?: string;
|
||||
phoneAreaCode?: string;
|
||||
phoneNumber?: string;
|
||||
heatMapFraction?: number;
|
||||
appointmentTime?: number;
|
||||
cancellationTime?: number;
|
||||
wapServerId?: string;
|
||||
appointmentAlert?: string;
|
||||
published?: COMPANY_PUBLISHED_STATUS;
|
||||
automaticNotifications?: boolean;
|
||||
templateWapNotifId?: string;
|
||||
templateWapAltaId?: string;
|
||||
templateEmailNotifId?: string;
|
||||
templateEmailAltaId?: string;
|
||||
onboardingStep?: number;
|
||||
onboardingCompleted?: boolean;
|
||||
fixedPostIds?: Array<string>;
|
||||
banned?: boolean;
|
||||
}
|
||||
|
||||
export interface MyOranizationsView {
|
||||
id: string;
|
||||
name: string;
|
||||
slug: string;
|
||||
description: string;
|
||||
categoryId: number;
|
||||
ownerId: string;
|
||||
employeeId: string;
|
||||
isOwner: boolean;
|
||||
isAdmin: boolean;
|
||||
hostOk: boolean;
|
||||
guestOk: boolean;
|
||||
fullOk: boolean;
|
||||
headerFile?: string;
|
||||
headerColor?: string;
|
||||
headerFontColor?: string;
|
||||
headerFontShadowColor?: string;
|
||||
iconFile?: string;
|
||||
logoFile?: string;
|
||||
phoneAreaCode?: string;
|
||||
phoneNumber?: string;
|
||||
heatMapFraction?: number;
|
||||
appointmentTime?: number;
|
||||
cancellationTime?: number;
|
||||
block?: string;
|
||||
street?: string;
|
||||
streetNumber?: string;
|
||||
builingFloor?: string;
|
||||
buildingApartament?: string;
|
||||
city?: string;
|
||||
state?: string;
|
||||
country?: string;
|
||||
zipCode?: string;
|
||||
latitude?: number;
|
||||
longitude?: number;
|
||||
published?: COMPANY_PUBLISHED_STATUS;
|
||||
automaticNotifications?: boolean;
|
||||
appointmentAlert?: string;
|
||||
templateWapNotifId?: string;
|
||||
templateWapAltaId?: string;
|
||||
templateEmailNotifId?: string;
|
||||
templateEmailAltaId?: string;
|
||||
onboardingStep?: number;
|
||||
onboardingCompleted?: boolean;
|
||||
banned?: boolean;
|
||||
}
|
||||
|
||||
export interface ClientOrganizationView {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
slug: string;
|
||||
iconFile: string;
|
||||
logoFile: string;
|
||||
}
|
||||
|
||||
export interface MyOranizationsViewParams {
|
||||
sessionUser: string;
|
||||
}
|
||||
|
||||
export interface ClientOranizationsViewParams {
|
||||
clientId: string;
|
||||
sessionUser: string;
|
||||
}
|
||||
|
||||
export interface OranizationsViewByIdParams {
|
||||
id: string;
|
||||
sessionUser: string;
|
||||
}
|
||||
|
||||
export type PaginateCompaniesParams = FindCompaniesParams & {
|
||||
page: number;
|
||||
limit: number;
|
||||
};
|
||||
|
||||
export type PaginateCompaniesResults = {
|
||||
data: ICompany[];
|
||||
page: number;
|
||||
pages: number;
|
||||
};
|
||||
|
||||
export type SysAdminPaginateCompaniesParams = PaginateCompaniesParams & {
|
||||
banned?: boolean;
|
||||
};
|
||||
|
||||
export type SysAdminUpdateCompanyParams = {
|
||||
id: string;
|
||||
name?: string;
|
||||
description?: string;
|
||||
categoryId?: number;
|
||||
};
|
||||
|
||||
export type SysAdminSetCompanyBannedParams = {
|
||||
id: string;
|
||||
banned: boolean;
|
||||
};
|
||||
|
||||
export type FixCompanyPostParams = {
|
||||
companyId: string;
|
||||
postId: string;
|
||||
sessionUser: string;
|
||||
};
|
||||
|
||||
export type MoveCompanyFixedPostParams = {
|
||||
companyId: string;
|
||||
postId: string;
|
||||
moveLength: number;
|
||||
sessionUser: string;
|
||||
};
|
||||
|
||||
export interface ICompaniesAdapter {
|
||||
create(company: ICompany): Promise<ICompany>;
|
||||
delete(id: string): Promise<void>;
|
||||
find(filters: FindCompaniesParams): Promise<ICompany[]>;
|
||||
findOne(filters: FindCompaniesParams): Promise<ICompanyDocument | null>;
|
||||
paginate(filters: PaginateCompaniesParams): Promise<PaginateCompaniesResults>;
|
||||
sysAdminPaginate(data: SysAdminPaginateCompaniesParams): Promise<PaginateCompaniesResults>;
|
||||
paginateFilterAll(data: PaginateCompaniesParams): Promise<PaginateCompaniesResults>;
|
||||
update(data: UpdateCompanyParams): Promise<void>;
|
||||
}
|
||||
|
||||
export interface ICompaniesManager {
|
||||
companies: ICompaniesAdapter;
|
||||
createCompany(data: CreateCompanyParams): Promise<ICompany>;
|
||||
isValidName(data: FindCompaniesParams): Promise<boolean>;
|
||||
updateCompany(data: UpdateCompanyParams): Promise<void>;
|
||||
setCompanyHeader(data: SetCompanyFileParams): Promise<void>;
|
||||
setCompanyIcon(data: SetCompanyFileParams): Promise<void>;
|
||||
deleteCompanyHeader(data: DeleteCompanyFileParams): Promise<void>;
|
||||
deleteCompanyIcon(data: DeleteCompanyFileParams): Promise<void>;
|
||||
getByUserId(data: MyOranizationsViewParams): Promise<MyOranizationsView[]>;
|
||||
getByClientId(data: ClientOranizationsViewParams): Promise<ClientOrganizationView[]>;
|
||||
getById(data: OranizationsViewByIdParams): Promise<MyOranizationsView>;
|
||||
filterAll(data: PaginateCompaniesParams): Promise<TextObjectFilterResult[]>;
|
||||
getCompanyAddress(data: ICompany): string;
|
||||
deleteCompany(data: DeleteCompanyParams): Promise<void>;
|
||||
setPublishedStatus(data: SetOrganizationPublishedStatusParams): Promise<void>;
|
||||
setNotificationAuto(data: SetNotificationAutoParams): Promise<void>;
|
||||
toggleFixedPost(data: FixCompanyPostParams): Promise<void>;
|
||||
moveFixedPost(data: MoveCompanyFixedPostParams): Promise<void>;
|
||||
sysAdminPaginate(data: SysAdminPaginateCompaniesParams): Promise<PaginateCompaniesResults>;
|
||||
sysAdminUpdate(data: SysAdminUpdateCompanyParams): Promise<void>;
|
||||
sysAdminSetBanned(data: SysAdminSetCompanyBannedParams): Promise<void>;
|
||||
}
|
||||
Reference in New Issue
Block a user