mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-09-02 09:00:59 +02:00
* Add repository name index * Optimize repository file counts * Optimize MongoDB query workloads
62 lines
1.1 KiB
TypeScript
62 lines
1.1 KiB
TypeScript
import { Schema } from "mongoose";
|
|
|
|
const RepositorySchema = new Schema({
|
|
name: String,
|
|
conferenceID: {
|
|
type: String,
|
|
index: { unique: true },
|
|
},
|
|
url: String,
|
|
startDate: Date,
|
|
endDate: Date,
|
|
status: String,
|
|
owners: { type: [Schema.Types.ObjectId] },
|
|
repositories: {
|
|
type: [
|
|
{
|
|
id: { type: Schema.Types.ObjectId },
|
|
addDate: { type: Date },
|
|
removeDate: { type: Date },
|
|
},
|
|
],
|
|
},
|
|
options: {
|
|
expirationMode: String,
|
|
expirationDate: Date,
|
|
update: Boolean,
|
|
image: Boolean,
|
|
pdf: Boolean,
|
|
notebook: Boolean,
|
|
link: Boolean,
|
|
page: Boolean,
|
|
},
|
|
dateOfEntry: {
|
|
type: Date,
|
|
default: new Date(),
|
|
},
|
|
plan: {
|
|
planID: String,
|
|
pricePerRepository: Number,
|
|
quota: {
|
|
repository: Number,
|
|
size: Number,
|
|
file: Number,
|
|
},
|
|
},
|
|
billing: {
|
|
name: String,
|
|
email: String,
|
|
address: String,
|
|
address2: String,
|
|
city: String,
|
|
zip: String,
|
|
country: String,
|
|
vat: String,
|
|
},
|
|
});
|
|
|
|
RepositorySchema.index({ owners: 1 });
|
|
RepositorySchema.index({ status: 1, endDate: 1 });
|
|
|
|
export default RepositorySchema;
|