oralify-common
Version:
Public shared repository for Oralify
118 lines (106 loc) • 3.18 kB
text/typescript
import { ServiceType, SpecialityKey } from './serviceType';
import {
AppointmentType,
AvailabilitySettingsType
} from './availabilityExpertTypes';
import { LanguageKey } from './languageTypes';
export enum Gender {
Male = 'Male',
Female = 'Female'
}
export enum RoleKey {
Admin = 'Admin',
Expert = 'Expert',
Curious = 'Curious'
}
export type CompanyType = {
id?: string;
specialityKey?: SpecialityKey;
keywords?: string[];
description?: string;
location?: string;
web?: string;
color?: string;
icon?: string;
img?: string;
name: string;
position?: string;
};
export type UserConciseType = {
id?: string;
nameShort?: string;
job?: string;
avatar?: string;
is_connected?: boolean;
avgReview?: number;
nReviews?: number;
isVerified?: boolean;
};
export type UserBackendType = UserConciseType & {
username?: string;
name?: string;
phone?: string;
creation_date?: Date | string;
birthday?: Date | string;
sex?: Gender;
languages?: LanguageKey[];
score?: number;
headline?: string;
education?: string;
email?: string;
role?: RoleKey; //online now
email_verified?: boolean;
phone_verified?: boolean;
provider?: 'phone' | 'password' | 'google.com';
last_sign_in?: string;
speciality?: SpecialityKey[];
};
/** 1 - user*/
/** 2 - availability []*/
/** 3 - services[] */
/** 4 - for each => backend generates timeSlots[] */
/** User type to frontend to generate the whole users*/
export type UserType = UserBackendType & {
services?: /*ServiceMapType |*/ ServiceType[]; //ServiceType[]; with
//availability?: AvailabilitySettingsType[] /** [{Lu, mar, Jueves,
// 16-18h},{Ju, vie, 20-22h}, ]*/;
reviews?: number | ReviewType[];
highlights?: CompanyType /*| CompanyType[]*/;
notifications?: AppointmentType[];
availabilityexpert?: AvailabilitySettingsType[];
history?: AppointmentType[];
};
export type ShownUserType = UserConciseType & {
services?: ServiceType[];
availabilityexpert?: AvailabilitySettingsType[];
};
export type ReviewType = {
id?: string;
curiousId: string;
review: number;
serviceId: string;
comment?: string;
expertId: string;
date: Date;
};
export type ShownReviewType = ReviewType & {
curiousUser: UserConciseType;
service: ServiceType;
};
/** Roles*/
export const roleMap = {
[RoleKey.Curious]: {
icon: 'lightbulb',
img: 'https://img.freepik.com/free-vector/features-overview-concept-illustration_114360-1500.jpg?w=1480&t=st=1694564247~exp=1694564847~hmac=8a75a679ff6dca14ba1699dd62c30245a8955c786ab877acb77d6b56b6b6c03c',
name: 'Curioso',
subtitle: 'Resuelve tus dudas personalizadas',
key: RoleKey.Curious
},
[RoleKey.Expert]: {
icon: 'account-star',
img: 'https://img.freepik.com/free-vector/product-quality-concept-illustration_114360-7301.jpg?w=1480&t=st=1694564209~exp=1694564809~hmac=6ffea3cf34f3a5463a230a54b87acaa4a569710694e138944f0268d0f596d735',
name: 'Experto',
subtitle: 'Empieza a monetizar tus conocimientos cómo y cuando quieras',
key: RoleKey.Expert
}
};