Add cache helper to update user cache every 30 minutes
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
808f5e3b1c
commit
5f054b02a5
15 changed files with 85 additions and 2 deletions
|
@ -1,4 +1,4 @@
|
|||
import { Entity, OneToMany } from "typeorm";
|
||||
import { Column, Entity, OneToMany } from "typeorm";
|
||||
import BaseEntity from "../../contracts/BaseEntity";
|
||||
import Role from "./Role";
|
||||
import Setting from "./Setting";
|
||||
|
@ -9,14 +9,22 @@ export default class Server extends BaseEntity {
|
|||
super();
|
||||
|
||||
this.Id = serverId;
|
||||
this.LastCached = new Date();
|
||||
}
|
||||
|
||||
@Column({ default: "2024-03-01 18:10:04" })
|
||||
LastCached: Date;
|
||||
|
||||
@OneToMany(() => Setting, x => x.Server)
|
||||
Settings: Setting[];
|
||||
|
||||
@OneToMany(() => Role, x => x.Server)
|
||||
Roles: Role[];
|
||||
|
||||
public UpdateLastCached(lastCached: Date) {
|
||||
this.LastCached = lastCached;
|
||||
}
|
||||
|
||||
public AddSettingToServer(setting: Setting) {
|
||||
this.Settings.push(setting);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm"
|
||||
import MigrationHelper from "../../../helpers/MigrationHelper"
|
||||
|
||||
export class AddServerCacheDate1709316734401 implements MigrationInterface {
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
MigrationHelper.Up('1709316734401-AddServerCacheDate', '3.2.1', [
|
||||
"01-Server",
|
||||
], queryRunner);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue