<commit_before>// model.js - A mongoose model
//
// See http://mongoosejs.com/docs/models.html
// for more of what you can do here.

const mongoose = require('mongoose');
const { getDocumentBaseDir } = require('./logic/school');
const { enableAuditLog } = require('../../utils/database');

const { Schema } = mongoose;
const fileStorageTypes = ['awsS3'];

const rssFeedSchema = new Schema({
	url: {
		type: String,
		required: true,
		unique: true,
		sparse: true,
	},
	description: {
		type: String,
		default: '',
	},
	status: {
		type: String,
		default: 'pending',
		enum: ['pending', 'success', 'error'],
	},
});
enableAuditLog(rssFeedSchema);

const customYearSchema = new Schema({
	yearId: { type: Schema.Types.ObjectId, ref: 'year', required: true },
	startDate: { type: Date, required: true },
	endDate: { type: Date, required: true },
});

const schoolSchema = new Schema({
	name: { type: String, required: true },
	address: { type: Object },
	fileStorageType: { type: String, enum: fileStorageTypes },
	schoolGroupId: { type: Schema.Types.ObjectId, ref: 'schoolGroup' },
	documentBaseDirType: {
		type: String,
		required: false,
		default: '',
		enum: ['', 'school', 'schoolGroup'],
	},
	systems: [{ type: Schema.Types.ObjectId, ref: 'system' }],
	federalState: { type: Schema.Types.ObjectId, ref: 'federalstate' },
	createdAt: { type: Date, default: Date.now },
	ldapSchoolIdentifier: { type: String },
	updatedAt: { type: Date, default: Date.now },
	experimental: { type: Boolean, default: false },
	pilot: { type: Boolean, default: false },
	currentYear: { type: Schema.Types.ObjectId, ref: 'year' },
	customYears: [{ type: customYearSchema }],
	logo_dataUrl: { type: String },
	purpose: { type: String },
	rssFeeds: [{ type: rssFeedSchema }],
	features: [{ type: String, enum: ['rocketChat', 'disableStudentTeamCreation'] }],
	inMaintenanceSince: { type: Date }, // see schoolSchema#inMaintenance (below)
}, {
	timestamps: true,
});


const schoolGroupSchema = new Schema({
	name: { type: String, required: true },
}, { timestamps: true });


/**
 * Determine if school is in maintenance mode ("Schuljahreswechsel"):
 * 		inMaintenanceSince not set: maintenance mode is disabled (false)
 * 		inMaintenanceSince <  Date.now(): maintenance will be enabled at this date in the future (false)
 * 		inMaintenanceSince >= Date.now(): maintenance mode is enabled (true)
 */
schoolSchema.plugin(require('mongoose-lean-virtuals'));

schoolSchema.virtual('inMaintenance').get(function get() {
	return Boolean(this.inMaintenanceSince && this.inMaintenanceSince <= Date.now());<commit_msg>add videoconference to school features<commit_after>// model.js - A mongoose model
//
// See http://mongoosejs.com/docs/models.html
// for more of what you can do here.

const mongoose = require('mongoose');
const { getDocumentBaseDir } = require('./logic/school');
const { enableAuditLog } = require('../../utils/database');

const { Schema } = mongoose;
const fileStorageTypes = ['awsS3'];

const rssFeedSchema = new Schema({
	url: {
		type: String,
		required: true,
		unique: true,
		sparse: true,
	},
	description: {
		type: String,
		default: '',
	},
	status: {
		type: String,
		default: 'pending',
		enum: ['pending', 'success', 'error'],
	},
});
enableAuditLog(rssFeedSchema);

const customYearSchema = new Schema({
	yearId: { type: Schema.Types.ObjectId, ref: 'year', required: true },
	startDate: { type: Date, required: true },
	endDate: { type: Date, required: true },
});

const schoolSchema = new Schema({
	name: { type: String, required: true },
	address: { type: Object },
	fileStorageType: { type: String, enum: fileStorageTypes },
	schoolGroupId: { type: Schema.Types.ObjectId, ref: 'schoolGroup' },
	documentBaseDirType: {
		type: String,
		required: false,
		default: '',
		enum: ['', 'school', 'schoolGroup'],
	},
	systems: [{ type: Schema.Types.ObjectId, ref: 'system' }],
	federalState: { type: Schema.Types.ObjectId, ref: 'federalstate' },
	createdAt: { type: Date, default: Date.now },
	ldapSchoolIdentifier: { type: String },
	updatedAt: { type: Date, default: Date.now },
	experimental: { type: Boolean, default: false },
	pilot: { type: Boolean, default: false },
	currentYear: { type: Schema.Types.ObjectId, ref: 'year' },
	customYears: [{ type: customYearSchema }],
	logo_dataUrl: { type: String },
	purpose: { type: String },
	rssFeeds: [{ type: rssFeedSchema }],
	features: [{ type: String, enum: ['rocketChat', 'disableStudentTeamCreation', 'videoconference'] }],
	inMaintenanceSince: { type: Date }, // see schoolSchema#inMaintenance (below)
}, {
	timestamps: true,
});


const schoolGroupSchema = new Schema({
	name: { type: String, required: true },
}, { timestamps: true });


/**
 * Determine if school is in maintenance mode ("Schuljahreswechsel"):
 * 		inMaintenanceSince not set: maintenance mode is disabled (false)
 * 		inMaintenanceSince <  Date.now(): maintenance will be enabled at this date in the future (false)
 * 		inMaintenanceSince >= Date.now(): maintenance mode is enabled (true)
 */
schoolSchema.plugin(require('mongoose-lean-virtuals'));

schoolSchema.virtual('inMaintenance').get(function get() {
	return Boolean(this.inMaintenanceSince && this.inMaintenanceSince <= Date.now());
{'fraction_non_alphanumeric': 0.1592734225621415, 'fraction_numerical': 0.0003824091778202677, 'mean_word_length': 4.735745614035087, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5422336', 'n_tokens_mistral': 1699, 'n_tokens_neox': 1658, 'n_words': 458}