first commit
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
import mongoose, { Schema, Document } from "mongoose";
|
||||
|
||||
export interface ICompany extends Document {
|
||||
name: string;
|
||||
}
|
||||
|
||||
const CompanySchema = new Schema<ICompany>({
|
||||
name: { type: String, required: true },
|
||||
});
|
||||
|
||||
export default mongoose.model<ICompany>("Companie", CompanySchema);
|
||||
@@ -0,0 +1,29 @@
|
||||
import mongoose, { Schema, Document } from "mongoose";
|
||||
|
||||
export interface IFile extends Document {
|
||||
objectName: string;
|
||||
originalName: string;
|
||||
size: number;
|
||||
mimeType: string;
|
||||
userId: string;
|
||||
organizationId: string;
|
||||
employeeId: string;
|
||||
serviceId: string;
|
||||
appointmentId: string;
|
||||
createdAt: Date;
|
||||
}
|
||||
|
||||
const DataFileSchema = new Schema<IFile>({
|
||||
objectName: { type: String, required: true },
|
||||
originalName: { type: String, required: true },
|
||||
size: { type: Number, required: true },
|
||||
mimeType: { type: String, required: true },
|
||||
userId: { type: String, required: false },
|
||||
organizationId: { type: String, required: false },
|
||||
employeeId: { type: String, required: false },
|
||||
serviceId: { type: String, required: false },
|
||||
appointmentId: { type: String, required: false },
|
||||
createdAt: { type: Date, default: Date.now },
|
||||
});
|
||||
|
||||
export default mongoose.model<IFile>("File", DataFileSchema);
|
||||
@@ -0,0 +1,14 @@
|
||||
import mongoose, { Schema, Document } from "mongoose";
|
||||
|
||||
export interface IEmployee extends Document {
|
||||
name: string;
|
||||
userId: Schema.Types.ObjectId;
|
||||
companyId: Schema.Types.ObjectId;
|
||||
}
|
||||
|
||||
const EmployeeSchema = new Schema<IEmployee>({
|
||||
userId: { type: Schema.Types.ObjectId, required: true, ref: "User" },
|
||||
companyId: { type: Schema.Types.ObjectId, required: true, ref: "Companie" },
|
||||
});
|
||||
|
||||
export default mongoose.model<IEmployee>("Employee", EmployeeSchema);
|
||||
@@ -0,0 +1,4 @@
|
||||
export type FileUploadParams = {
|
||||
originalName: string;
|
||||
objectName: string;
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
import mongoose, { Schema, Document } from "mongoose";
|
||||
|
||||
export interface IUser extends Document {
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
}
|
||||
|
||||
const UserSchema = new Schema<IUser>({
|
||||
firstName: { type: String, required: true },
|
||||
lastName: { type: String, required: true },
|
||||
});
|
||||
|
||||
export default mongoose.model<IUser>("User", UserSchema);
|
||||
Reference in New Issue
Block a user