first commit
This commit is contained in:
19
models/guru_model.ts
Normal file
19
models/guru_model.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import mongoose from "mongoose";
|
||||
|
||||
const matapelajaranSchema = new mongoose.Schema({
|
||||
matpel: { type: String, required: true }
|
||||
} , { _id: false });
|
||||
|
||||
const guruSchema = new mongoose.Schema({
|
||||
nig: { type: String, required: true },
|
||||
nama: { type: String, required: true },
|
||||
jk: { type: String, required: true },
|
||||
no_telpon: { type: String, required: true },
|
||||
password: { type: String, default: '12345678' },
|
||||
listmatapelajaran: [matapelajaranSchema]
|
||||
}, {
|
||||
timestamps: true,
|
||||
collection: 'guru'
|
||||
});
|
||||
|
||||
export const GuruModel = mongoose.model('Guru', guruSchema);
|
||||
23
models/jawaban_model.ts
Normal file
23
models/jawaban_model.ts
Normal file
@ -0,0 +1,23 @@
|
||||
// create jawaban model using mongoose
|
||||
import mongoose, { Document, Schema } from 'mongoose';
|
||||
|
||||
export interface Jawaban extends Document {
|
||||
nis: string;
|
||||
jawaban: string;
|
||||
soal: string;
|
||||
waktu: Date;
|
||||
}
|
||||
|
||||
const JawabanSchema = new Schema(
|
||||
{
|
||||
nis: { type: String, required: true },
|
||||
jawaban: { type: String, required: true },
|
||||
soal: { type: String, required: true },
|
||||
waktu: { type: Date, required: true },
|
||||
},
|
||||
{
|
||||
collection: 'jawaban_soal'
|
||||
}
|
||||
);
|
||||
|
||||
export const JawabanSoalModel = mongoose.model<Jawaban>('Jawaban', JawabanSchema);
|
||||
29
models/siswa_model.ts
Normal file
29
models/siswa_model.ts
Normal file
@ -0,0 +1,29 @@
|
||||
import mongoose, { Document, Schema } from 'mongoose';
|
||||
|
||||
export interface Siswa extends Document {
|
||||
readonly nis: string;
|
||||
readonly nama: string;
|
||||
readonly kelas: string;
|
||||
readonly jurusan: string;
|
||||
readonly jk: string;
|
||||
readonly password: string;
|
||||
readonly createdAt: Date;
|
||||
readonly updatedAt: Date;
|
||||
}
|
||||
|
||||
const SiswaSchema = new Schema(
|
||||
{
|
||||
nis: { type: String, required: true },
|
||||
nama: { type: String, required: true },
|
||||
kelas: { type: String, required: true },
|
||||
jurusan: { type: String, required: true },
|
||||
jk: { type: String, required: true },
|
||||
password: { type: String, default: '12345678' },
|
||||
},
|
||||
{
|
||||
timestamps: true,
|
||||
collection: 'siswa'
|
||||
}
|
||||
);
|
||||
|
||||
export const SiswaModel = mongoose.model<Siswa>('Siswa', SiswaSchema);
|
||||
Reference in New Issue
Block a user