28 lines
624 B
TypeScript
28 lines
624 B
TypeScript
import { GetAll, Create, Delete, GetById, Update, Count } from "../../bindings/app/internal/services/postservice.ts"
|
|
import type { Post } from "../../bindings/app/internal/services/models.ts"
|
|
import type { IService } from "../types/service.type.ts"
|
|
|
|
export default class PostService implements IService<Post> {
|
|
async read(id: number) {
|
|
return await GetById(id)
|
|
}
|
|
|
|
async readAll() {
|
|
return await GetAll()
|
|
}
|
|
|
|
async create(item: Post) {
|
|
await Create(item)
|
|
}
|
|
|
|
async delete(id: number) {
|
|
return await Delete(id)
|
|
}
|
|
async update(item: Post) {
|
|
await Update(item)
|
|
}
|
|
async count() {
|
|
return await Count()
|
|
}
|
|
}
|