mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-10 07:25:35 +00:00
refactor: create types instead of using models
This commit is contained in:
41
inertia/types/app.d.ts
vendored
41
inertia/types/app.d.ts
vendored
@@ -1,26 +1,55 @@
|
||||
import type Collection from '#models/collection';
|
||||
import { Visibility } from '@/app/enums/visibility';
|
||||
|
||||
type User = {
|
||||
type CommonBase = {
|
||||
id: number;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
};
|
||||
|
||||
type User = CommonBase & {
|
||||
email: string;
|
||||
name: string;
|
||||
nickName: string;
|
||||
fullname: string;
|
||||
avatarUrl: string;
|
||||
isAdmin: boolean;
|
||||
};
|
||||
|
||||
type UserWithCollections = User & {
|
||||
collections: Collection[];
|
||||
};
|
||||
|
||||
type UserWithRelationCount = {
|
||||
id: number;
|
||||
type UserWithRelationCount = CommonBase & {
|
||||
email: string;
|
||||
fullname: string;
|
||||
avatarUrl: string;
|
||||
isAdmin: string;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
count: {
|
||||
link: number;
|
||||
collection: number;
|
||||
};
|
||||
};
|
||||
|
||||
type Link = CommonBase & {
|
||||
name: string;
|
||||
description: string | null;
|
||||
url: string;
|
||||
favorite: boolean;
|
||||
collectionId: number;
|
||||
};
|
||||
|
||||
type LinkWithCollection = Link & {
|
||||
collection: Collection;
|
||||
};
|
||||
|
||||
type Collection = CommonBase & {
|
||||
name: string;
|
||||
description: string | null;
|
||||
visibility: Visibility;
|
||||
nextId: number;
|
||||
authorId: number;
|
||||
};
|
||||
|
||||
type CollectionWithLinks = Collection & {
|
||||
links: Link[];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user