2023-07-26 17:11:32 +02:00

36 lines
898 B
TypeScript

import BaseService from "@Services/BaseService";
import { Service } from "typedi";
import VotesRepository from "@Repositories/VotesRepository";
import { Prisma } from "@prisma/client";
@Service()
export default class VoteService extends BaseService {
constructor(private voteRepository: VotesRepository) {
super();
}
/**
* @description : Get all votes
* @throws {Error} If votes cannot be get
*/
public get(query: Prisma.VotesFindManyArgs) {
return this.voteRepository.findMany(query);
}
/**
* @description : Get a vote by uid
* @throws {Error} If vote cannot be get by uid
*/
public getByUid(uid: string, query?: Prisma.VotesInclude) {
return this.voteRepository.findOneByUid(uid, query);
}
/**
* @description : delete a vote by uid
* @throws {Error} If vote cannot be get by uid
*/
public delete(uid: string) {
return this.voteRepository.delete(uid);
}
}