Spaces:
Sleeping

File size: 798 Bytes
4e83772
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
28
import mongoose, { Document, Schema, Types } from "mongoose";

export interface IProjectBandwiths extends Document {
	_id: string;
	user: Types.ObjectId;
	project: Types.ObjectId;
	currentMonth: string;
	bandwidthMonthly: number;
	bandwidthTotal: number;
	createdAt: Date;
	updatedAt: Date;
}

const projectBandwidthsSchema = new Schema<IProjectBandwiths>(
	{
		user: { type: Schema.Types.ObjectId, ref: "User", required: true },
		project: { type: Schema.Types.ObjectId, ref: "Project", required: true },
		currentMonth: { type: String, default: "" },
		bandwidthMonthly: { type: Number, default: 0 },
		bandwidthTotal: { type: Number, default: 0 },
	},
	{
		timestamps: true,
	},
);

export const ProjectBandwidth = mongoose.model<IProjectBandwiths>("ProjectBandwidth", projectBandwidthsSchema);