30 lines
813 B
TypeScript
30 lines
813 B
TypeScript
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);
|