import { Schema } from "mongoose"; import { EnumMap,IJson,IDocument,IObject,IInstance,IModel,IAction,IActionTypes,ISettings,MiscInfo } from "@onebro/oba-common"; export enum CnDUserProfileStatuses { N = "New", S = "Saved", Y = "Sent", Z = "Seen/Read", A = "Accepted", D = "Declined", R = "Revised", E = "Expired", C = "Cancelled",} export type CnDUserProfileStatus = keyof typeof CnDUserProfileStatuses; export enum CnDRoles { G = "GUEST", U = "USER", A = "ADMIN", S = "SUPER", SA = "SYSADMIN"} export type CnDRole = keyof typeof CnDRoles; export type CnDExperienceLevel = "novice"|"beginner"|"intermediate"|"advanced"|"expert"; export type CnDUserProfileConfig = { username:string; role:CnDRole; settings:ISettings<"location"|"cookies">; img?:string;}; export type CnDUserProfileType = IObject & CnDUserProfileConfig & { bio:string; motto:string; socials?:MiscInfo; stats?:MiscInfo; expYrs?:number; expLvl?:CnDExperienceLevel; rating?:number; followers?:CnDUserProfile[]; following?:CnDUserProfile[];}; export interface CnDUserProfileDocument extends IDocument,CnDUserProfileType {lang:string;} export interface CnDUserProfile extends IInstance,CnDUserProfileDocument { following:CnDUserProfile[]; followers:CnDUserProfile[]; preview():CnDUserProfilePreview; follow(o:any):Promise; unfollow(o:any):Promise; rate(o:any):Promise; invite(o:any):Promise; respond(o:any):Promise;} export interface CnDUserProfileModel extends IModel {} export type CnDUSerProfilePublicKeys = "username"|"bio"|"motto"|"expYrs"|"expLvl"|"rating"|"settings"|"img"|"socials"|"lang"; export type CnDUSerProfilePublicData = Pick; export type CnDUserProfilePreview = Pick & {role:CnDRoles;}; export type CnDUserProfileJson = IJson & CnDUSerProfilePublicData & { role:CnDRoles; memberSince:Date; followers:CnDUserProfilePreview[]; following:CnDUserProfilePreview[];}; export type CnDUserProfileModelMap = {CnDUserProfile:CnDUserProfileModel;}; export type CnDUserProfileInstanceMap = {profile:CnDUserProfile;}; export type CnDUserProfileSchemaMap = {profile:Schema;}; export type CnDUserProfileActionTypes = IActionTypes|"fetchByUsername$"; export type CnDUserProfileActions = EnumMap; export type CnDUserProfileUpdateFollowersOrFollowing = Partial<{ addFollowers?:string[]; removeFollowers?:string[]; addFollowing?:string[]; removeFollowing?:string[];}>;