- addes @adonisjs/redis fo saving session into redis with redis.ts contract and config

- npm updated
- added createHashValues and dlete inside File.ts
- added dataset_count property inside Subject.ts
- corrected rotes.ts with correct permissions
This commit is contained in:
Kaimbacher 2023-11-27 17:17:22 +01:00
parent d8bdce1369
commit b6fdfbff41
29 changed files with 496 additions and 201 deletions

View file

@ -1,4 +1,4 @@
import { column, SnakeCaseNamingStrategy, manyToMany, ManyToMany, beforeCreate, beforeUpdate } from '@ioc:Adonis/Lucid/Orm';
import { column, SnakeCaseNamingStrategy, manyToMany, ManyToMany, computed} from '@ioc:Adonis/Lucid/Orm';
import BaseModel from './BaseModel';
import { DateTime } from 'luxon';
@ -44,28 +44,33 @@ export default class Subject extends BaseModel {
})
public updated_at: DateTime;
@beforeCreate()
@beforeUpdate()
public static async resetDate(role) {
role.created_at = this.formatDateTime(role.created_at);
role.updated_at = this.formatDateTime(role.updated_at);
}
// @beforeCreate()
// @beforeUpdate()
// public static async resetDate(role) {
// role.created_at = this.formatDateTime(role.created_at);
// role.updated_at = this.formatDateTime(role.updated_at);
// }
private static formatDateTime(datetime) {
let value = new Date(datetime);
return datetime
? value.getFullYear() +
'-' +
(value.getMonth() + 1) +
'-' +
value.getDate() +
' ' +
value.getHours() +
':' +
value.getMinutes() +
':' +
value.getSeconds()
: datetime;
// private static formatDateTime(datetime) {
// let value = new Date(datetime);
// return datetime
// ? value.getFullYear() +
// '-' +
// (value.getMonth() + 1) +
// '-' +
// value.getDate() +
// ' ' +
// value.getHours() +
// ':' +
// value.getMinutes() +
// ':' +
// value.getSeconds()
// : datetime;
// }
@computed()
public get dataset_count() : number{
const count = this.$extras.datasets_count; //my pivot column name was "stock"
return count;
}
@manyToMany(() => Dataset, {