45 lines
921 B
TypeScript
45 lines
921 B
TypeScript
import { Vote } from "le-coffre-resources/dist/SuperAdmin";
|
|
|
|
import BaseSuperAdmin from "../BaseSuperAdmin";
|
|
|
|
// TODO Type get query params -> Where + inclue + orderby
|
|
export interface IGetVotessparams {
|
|
where?: {};
|
|
include?: {};
|
|
select?: {};
|
|
}
|
|
|
|
export type IDeleteVotesParams = {
|
|
uid: Vote["uid"];
|
|
};
|
|
|
|
export default class Votes extends BaseSuperAdmin {
|
|
private static instance: Votes;
|
|
private readonly baseURl = this.namespaceUrl.concat("/votes");
|
|
|
|
private constructor() {
|
|
super();
|
|
}
|
|
|
|
public static getInstance() {
|
|
if (!this.instance) {
|
|
return new this();
|
|
} else {
|
|
return this.instance;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @description : Create a Votes
|
|
*/
|
|
public async delete(body: IDeleteVotesParams): Promise<Vote> {
|
|
const url = new URL(this.baseURl + "/" + body.uid);
|
|
try {
|
|
return await this.deleteRequest<Vote>(url, body);
|
|
} catch (err) {
|
|
this.onError(err);
|
|
return Promise.reject(err);
|
|
}
|
|
}
|
|
}
|