mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-10 15:35:35 +00:00
refactor: use tabs instead of spaces
This commit is contained in:
@@ -1,25 +1,25 @@
|
||||
import {
|
||||
BaseModel,
|
||||
CamelCaseNamingStrategy,
|
||||
column,
|
||||
BaseModel,
|
||||
CamelCaseNamingStrategy,
|
||||
column,
|
||||
} from '@adonisjs/lucid/orm';
|
||||
import { DateTime } from 'luxon';
|
||||
|
||||
export default class AppBaseModel extends BaseModel {
|
||||
static namingStrategy = new CamelCaseNamingStrategy();
|
||||
serializeExtras = true;
|
||||
static namingStrategy = new CamelCaseNamingStrategy();
|
||||
serializeExtras = true;
|
||||
|
||||
@column({ isPrimary: true })
|
||||
declare id: number;
|
||||
@column({ isPrimary: true })
|
||||
declare id: number;
|
||||
|
||||
@column.dateTime({
|
||||
autoCreate: true,
|
||||
})
|
||||
declare createdAt: DateTime;
|
||||
@column.dateTime({
|
||||
autoCreate: true,
|
||||
})
|
||||
declare createdAt: DateTime;
|
||||
|
||||
@column.dateTime({
|
||||
autoCreate: true,
|
||||
autoUpdate: true,
|
||||
})
|
||||
declare updatedAt: DateTime;
|
||||
@column.dateTime({
|
||||
autoCreate: true,
|
||||
autoUpdate: true,
|
||||
})
|
||||
declare updatedAt: DateTime;
|
||||
}
|
||||
|
||||
@@ -6,24 +6,24 @@ import type { BelongsTo, HasMany } from '@adonisjs/lucid/types/relations';
|
||||
import { Visibility } from '#enums/visibility';
|
||||
|
||||
export default class Collection extends AppBaseModel {
|
||||
@column()
|
||||
declare name: string;
|
||||
@column()
|
||||
declare name: string;
|
||||
|
||||
@column()
|
||||
declare description: string | null;
|
||||
@column()
|
||||
declare description: string | null;
|
||||
|
||||
@column()
|
||||
declare visibility: Visibility;
|
||||
@column()
|
||||
declare visibility: Visibility;
|
||||
|
||||
@column()
|
||||
declare nextId: number;
|
||||
@column()
|
||||
declare nextId: number;
|
||||
|
||||
@column()
|
||||
declare authorId: number;
|
||||
@column()
|
||||
declare authorId: number;
|
||||
|
||||
@belongsTo(() => User, { foreignKey: 'authorId' })
|
||||
declare author: BelongsTo<typeof User>;
|
||||
@belongsTo(() => User, { foreignKey: 'authorId' })
|
||||
declare author: BelongsTo<typeof User>;
|
||||
|
||||
@hasMany(() => Link)
|
||||
declare links: HasMany<typeof Link>;
|
||||
@hasMany(() => Link)
|
||||
declare links: HasMany<typeof Link>;
|
||||
}
|
||||
|
||||
@@ -5,27 +5,27 @@ import { belongsTo, column } from '@adonisjs/lucid/orm';
|
||||
import type { BelongsTo } from '@adonisjs/lucid/types/relations';
|
||||
|
||||
export default class Link extends AppBaseModel {
|
||||
@column()
|
||||
declare name: string;
|
||||
@column()
|
||||
declare name: string;
|
||||
|
||||
@column()
|
||||
declare description: string | null;
|
||||
@column()
|
||||
declare description: string | null;
|
||||
|
||||
@column()
|
||||
declare url: string;
|
||||
@column()
|
||||
declare url: string;
|
||||
|
||||
@column()
|
||||
declare favorite: boolean;
|
||||
@column()
|
||||
declare favorite: boolean;
|
||||
|
||||
@column()
|
||||
declare collectionId: number;
|
||||
@column()
|
||||
declare collectionId: number;
|
||||
|
||||
@belongsTo(() => Collection, { foreignKey: 'collectionId' })
|
||||
declare collection: BelongsTo<typeof Collection>;
|
||||
@belongsTo(() => Collection, { foreignKey: 'collectionId' })
|
||||
declare collection: BelongsTo<typeof Collection>;
|
||||
|
||||
@column()
|
||||
declare authorId: number;
|
||||
@column()
|
||||
declare authorId: number;
|
||||
|
||||
@belongsTo(() => User, { foreignKey: 'authorId' })
|
||||
declare author: BelongsTo<typeof User>;
|
||||
@belongsTo(() => User, { foreignKey: 'authorId' })
|
||||
declare author: BelongsTo<typeof User>;
|
||||
}
|
||||
|
||||
@@ -6,42 +6,42 @@ import type { HasMany } from '@adonisjs/lucid/types/relations';
|
||||
import AppBaseModel from './app_base_model.js';
|
||||
|
||||
export default class User extends AppBaseModel {
|
||||
@column()
|
||||
declare email: string;
|
||||
@column()
|
||||
declare email: string;
|
||||
|
||||
@column()
|
||||
declare name: string;
|
||||
@column()
|
||||
declare name: string;
|
||||
|
||||
@column()
|
||||
declare nickName: string; // public username
|
||||
@column()
|
||||
declare nickName: string; // public username
|
||||
|
||||
@column()
|
||||
declare avatarUrl: string;
|
||||
@column()
|
||||
declare avatarUrl: string;
|
||||
|
||||
@column()
|
||||
declare isAdmin: boolean;
|
||||
@column()
|
||||
declare isAdmin: boolean;
|
||||
|
||||
@column({ serializeAs: null })
|
||||
declare token?: GoogleToken;
|
||||
@column({ serializeAs: null })
|
||||
declare token?: GoogleToken;
|
||||
|
||||
@column({ serializeAs: null })
|
||||
declare providerId: number;
|
||||
@column({ serializeAs: null })
|
||||
declare providerId: number;
|
||||
|
||||
@column({ serializeAs: null })
|
||||
declare providerType: 'google';
|
||||
@column({ serializeAs: null })
|
||||
declare providerType: 'google';
|
||||
|
||||
@hasMany(() => Collection, {
|
||||
foreignKey: 'authorId',
|
||||
})
|
||||
declare collections: HasMany<typeof Collection>;
|
||||
@hasMany(() => Collection, {
|
||||
foreignKey: 'authorId',
|
||||
})
|
||||
declare collections: HasMany<typeof Collection>;
|
||||
|
||||
@hasMany(() => Link, {
|
||||
foreignKey: 'authorId',
|
||||
})
|
||||
declare links: HasMany<typeof Link>;
|
||||
@hasMany(() => Link, {
|
||||
foreignKey: 'authorId',
|
||||
})
|
||||
declare links: HasMany<typeof Link>;
|
||||
|
||||
@computed()
|
||||
get fullname() {
|
||||
return this.nickName || this.name;
|
||||
}
|
||||
@computed()
|
||||
get fullname() {
|
||||
return this.nickName || this.name;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user