mirror of https://github.com/aruppi/aruppi-api.git
💥 Implementing the models for each collection
parent
fc2dc9ae79
commit
d35db8944e
@ -0,0 +1,19 @@
|
||||
import { Document, model, Types, Schema } from 'mongoose';
|
||||
|
||||
/*
|
||||
This is the model for each genre
|
||||
of the directory, the genre model.
|
||||
*/
|
||||
|
||||
export interface Genre extends Document {
|
||||
name: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
// Schema for the theme
|
||||
const GenreSchema: Schema = new Schema({
|
||||
name: { type: String },
|
||||
value: { type: String },
|
||||
});
|
||||
|
||||
export default model<Genre>('Genre', GenreSchema);
|
@ -0,0 +1,19 @@
|
||||
import { Document, model, Schema } from 'mongoose';
|
||||
|
||||
/*
|
||||
This is the model for each radiostation
|
||||
of the directory, the radiostation model.
|
||||
*/
|
||||
|
||||
export interface RadioStation extends Document {
|
||||
name: string;
|
||||
url: string;
|
||||
}
|
||||
|
||||
// Schema for the theme
|
||||
const RadioStationSchema: Schema = new Schema({
|
||||
name: { type: String },
|
||||
url: { type: String },
|
||||
});
|
||||
|
||||
export default model<RadioStation>('RadioStation', RadioStationSchema);
|
@ -0,0 +1,29 @@
|
||||
import { Document, model, Types, Schema } from 'mongoose';
|
||||
|
||||
/*
|
||||
This is the model for each theme
|
||||
of the directory, the theme model.
|
||||
*/
|
||||
|
||||
interface TInterface {
|
||||
title: string;
|
||||
video: string;
|
||||
type: string;
|
||||
}
|
||||
|
||||
export interface Theme extends Document {
|
||||
id: string;
|
||||
title: string;
|
||||
year: string;
|
||||
themes: Types.Array<TInterface>;
|
||||
}
|
||||
|
||||
// Schema for the theme
|
||||
const ThemeSchema: Schema = new Schema({
|
||||
id: { type: String },
|
||||
title: { type: String },
|
||||
year: { type: String },
|
||||
themes: [{ type: Object }],
|
||||
});
|
||||
|
||||
export default model<Theme>('Theme', ThemeSchema);
|
Loading…
Reference in New Issue