mirror of
https://github.com/SECTL/SecScore.git
synced 2026-07-21 18:19:03 +08:00
31 lines
667 B
TypeScript
31 lines
667 B
TypeScript
import { Service } from "../shared/kernel"
|
|
import { ClientContext } from "../ClientContext"
|
|
|
|
declare module "../shared/kernel" {
|
|
interface Context {
|
|
students: StudentService
|
|
}
|
|
}
|
|
|
|
export class StudentService extends Service {
|
|
constructor(ctx: ClientContext) {
|
|
super(ctx, "students")
|
|
}
|
|
|
|
async findAll() {
|
|
return await (window as any).api.queryStudents({})
|
|
}
|
|
|
|
async create(data: any) {
|
|
return await (window as any).api.createStudent(data)
|
|
}
|
|
|
|
async update(id: number, data: any) {
|
|
return await (window as any).api.updateStudent(id, data)
|
|
}
|
|
|
|
async delete(id: number) {
|
|
return await (window as any).api.deleteStudent(id)
|
|
}
|
|
}
|