forked from geolba/tethys.backend
- added own provider for drive methods
- renamed middleware Role and Can to role_middleware and can_middleware - added some typing for inertia vue3 components - npm updates
This commit is contained in:
parent
cb51a4136f
commit
296c8fd46e
67 changed files with 2515 additions and 1913 deletions
|
@ -7,7 +7,8 @@ import BaseModel from './BaseModel.js';
|
|||
import * as fs from 'fs';
|
||||
import crypto from 'crypto';
|
||||
// import Drive from '@ioc:Adonis/Core/Drive';
|
||||
import Drive from '@adonisjs/drive';
|
||||
// import Drive from '@adonisjs/drive';
|
||||
import drive from '#services/drive';
|
||||
|
||||
import type { HasMany } from "@adonisjs/lucid/types/relations";
|
||||
import type { BelongsTo } from "@adonisjs/lucid/types/relations";
|
||||
|
@ -164,7 +165,7 @@ export default class File extends BaseModel {
|
|||
public async delete() {
|
||||
if (this.pathName) {
|
||||
// Delete file from additional storage
|
||||
await Drive.delete(this.pathName);
|
||||
await drive.delete(this.pathName);
|
||||
}
|
||||
|
||||
// Call the original delete method of the BaseModel to remove the record from the database
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
import { DateTime } from 'luxon';
|
||||
import { withAuthFinder } from '@adonisjs/auth';
|
||||
import { column, beforeSave, manyToMany, hasMany } from '@adonisjs/lucid/orm';
|
||||
import { withAuthFinder } from '@adonisjs/auth/mixins/lucid'
|
||||
import { column, manyToMany, hasMany } from '@adonisjs/lucid/orm';
|
||||
import hash from '@adonisjs/core/services/hash';
|
||||
import Role from './Role.js';
|
||||
import db from '@adonisjs/lucid/services/db';
|
||||
// import Config from '@ioc:Adonis/Core/Config';
|
||||
import config from '@adonisjs/core/services/config';
|
||||
import Dataset from './Dataset.js';
|
||||
import BaseModel from './BaseModel.js';
|
||||
|
@ -84,12 +83,12 @@ export default class User extends compose(BaseModel, AuthFinder) {
|
|||
// })
|
||||
// public totp_secret: HasOne<typeof TotpSecret>;
|
||||
|
||||
@beforeSave()
|
||||
public static async hashPassword(user: User) {
|
||||
if (user.$dirty.password) {
|
||||
user.password = await hash.use('laravel').make(user.password);
|
||||
}
|
||||
}
|
||||
// @beforeSave()
|
||||
// public static async hashPassword(user: User) {
|
||||
// if (user.$dirty.password) {
|
||||
// user.password = await hash.use('laravel').make(user.password);
|
||||
// }
|
||||
// }
|
||||
|
||||
public get isTwoFactorEnabled(): boolean {
|
||||
return Boolean(this?.twoFactorSecret && this.state == TotpState.STATE_ENABLED);
|
||||
|
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue