Files
nto-cli/generation/templates/service.tmpl
2025-03-08 19:27:18 +07:00

29 lines
697 B
Cheetah

import { GetAll, Create, Delete, GetById, Update, Count } from "../../bindings/app/internal/services/{{.LowerModelName}}service.ts"
import type { {{.ModelName}} } from "{{.ServicesPath}}"
import type { IService } from "../types/service.type.ts"
export default class {{.ModelName}}Service implements IService<{{.ModelName}}> {
async read(id: number) {
return await GetById(id) as {{.ModelName}}
}
async readAll() {
return await GetAll() as {{.ModelName}}[]
}
async create(item: {{.ModelName}}) {
await Create(item)
}
async delete(id: number) {
return await Delete(id)
}
async update(item: {{.ModelName}}) {
await Update(item)
}
async count() {
return await Count()
}
}