forked from EvolutionAPI/evolution-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontact.model.ts
More file actions
27 lines (22 loc) · 771 Bytes
/
contact.model.ts
File metadata and controls
27 lines (22 loc) · 771 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { Schema } from 'mongoose';
import { dbserver } from '../../libs/db.connect';
export class ContactRaw {
_id?: string;
pushName?: string;
id?: string;
profilePictureUrl?: string;
owner: string;
}
type ContactRawBoolean<T> = {
[P in keyof T]?: 0 | 1;
};
export type ContactRawSelect = ContactRawBoolean<ContactRaw>;
const contactSchema = new Schema<ContactRaw>({
_id: { type: String, _id: true },
pushName: { type: String, minlength: 1 },
id: { type: String, required: true, minlength: 1 },
profilePictureUrl: { type: String, minlength: 1 },
owner: { type: String, required: true, minlength: 1 },
});
export const ContactModel = dbserver?.model(ContactRaw.name, contactSchema, 'contacts');
export type IContactModel = typeof ContactModel;