This commit is contained in:
Rutra
2026-05-13 11:50:22 +02:00
commit 2068229f89
128 changed files with 9215 additions and 0 deletions

16
app/models/user.js Normal file
View File

@@ -0,0 +1,16 @@
import { UserSchema } from '#database/schema';
import hash from '@adonisjs/core/services/hash';
import { compose } from '@adonisjs/core/helpers';
import { withAuthFinder } from '@adonisjs/auth/mixins/lucid';
import { DbAccessTokensProvider } from '@adonisjs/auth/access_tokens';
export default class User extends compose(UserSchema, withAuthFinder(hash)) {
static accessTokens = DbAccessTokensProvider.forModel(User);
get initials() {
const [first, last] = this.fullName ? this.fullName.split(' ') : this.email.split('@');
if (first && last) {
return `${first.charAt(0)}${last.charAt(0)}`.toUpperCase();
}
return `${first.slice(0, 2)}`.toUpperCase();
}
}
//# sourceMappingURL=user.js.map