fix: system repositories.

This commit is contained in:
a.bouhuolia
2020-12-17 17:19:16 +02:00
parent 7a847fc895
commit a67b1fbdd0
54 changed files with 1452 additions and 983 deletions

View File

@@ -4,19 +4,18 @@ import { Expense } from 'models';
export default class ExpenseRepository extends TenantRepository {
/**
* Constructor method.
* Gets the repository's model.
*/
constructor(knex, cache) {
super(knex, cache);
this.model = Expense;
get model() {
return Expense.bindKnex(this.knex);
}
/**
* Publish the given expense.
* @param {number} expenseId
*/
async publish(expenseId: number): Promise<void> {
super.update({
publish(expenseId: number): Promise<void> {
return super.update({
id: expenseId,
publishedAt: moment().toMySqlDateTime(),
});