01646ebcb7
#28 件数 0 件除外をついでに対応(フロントのみ;バックエンドは後で対応) #28 Co-authored-by: miteruzo <miteruzo@naver.com> Reviewed-on: #244
97 行
2.5 KiB
TypeScript
97 行
2.5 KiB
TypeScript
import { CATEGORIES, USER_ROLES, ViewFlagBehavior } from '@/consts'
|
|
|
|
import type { ReactNode } from 'react'
|
|
|
|
export type Category = typeof CATEGORIES[number]
|
|
|
|
export type Menu = MenuItem[]
|
|
|
|
export type MenuItem = {
|
|
name: string
|
|
to: string
|
|
base?: string
|
|
subMenu: SubMenuItem[] }
|
|
|
|
export type NicoTag = Tag & {
|
|
category: 'nico'
|
|
linkedTags: Tag[] }
|
|
|
|
export type Post = {
|
|
id: number
|
|
url: string
|
|
title: string
|
|
thumbnail: string
|
|
thumbnailBase: string
|
|
tags: Tag[]
|
|
viewed: boolean
|
|
related: Post[]
|
|
createdAt: string
|
|
originalCreatedFrom: string | null
|
|
originalCreatedBefore: string | null }
|
|
|
|
export type PostTagChange = {
|
|
post: Post
|
|
tag: Tag
|
|
user?: User
|
|
changeType: 'add' | 'remove'
|
|
timestamp: string }
|
|
|
|
export type SubMenuItem =
|
|
| { component: ReactNode
|
|
visible: boolean }
|
|
| { name: string
|
|
to: string
|
|
visible?: boolean }
|
|
|
|
export type Tag = {
|
|
id: number
|
|
name: string
|
|
category: Category
|
|
postCount: number
|
|
hasWiki: boolean
|
|
children?: Tag[]
|
|
matchedAlias?: string | null }
|
|
|
|
export type User = {
|
|
id: number
|
|
name: string | null
|
|
inheritanceCode: string
|
|
role: UserRole }
|
|
|
|
export type ViewFlagBehavior = typeof ViewFlagBehavior[keyof typeof ViewFlagBehavior]
|
|
|
|
export type WikiPage = {
|
|
id: number
|
|
title: string
|
|
createdUserId: number
|
|
updatedUserId: number
|
|
createdAt: string
|
|
updatedAt: string
|
|
body: string
|
|
revisionId: number
|
|
pred: number | null
|
|
succ: number | null }
|
|
|
|
export type WikiPageChange = {
|
|
revisionId: number
|
|
pred: number | null
|
|
succ: null
|
|
wikiPage: Pick<WikiPage, 'id' | 'title'>
|
|
user: Pick<User, 'id' | 'name'>
|
|
kind: 'content' | 'redirect'
|
|
message: string | null
|
|
timestamp: string }
|
|
|
|
export type WikiPageDiff = {
|
|
wikiPageId: number
|
|
title: string
|
|
olderRevisionId: number | null
|
|
newerRevisionId: number
|
|
diff: WikiPageDiffDiff[] }
|
|
|
|
export type WikiPageDiffDiff = {
|
|
type: 'context' | 'added' | 'removed'
|
|
content: string }
|
|
|
|
export type UserRole = typeof USER_ROLES[number]
|