diff --git a/src/modules/categories.ts b/src/modules/categories.ts index 8a42523..f7c3339 100644 --- a/src/modules/categories.ts +++ b/src/modules/categories.ts @@ -17,6 +17,7 @@ import type { FieldData } from "./fields"; export interface ICategory extends Entity, TreeNode, Fields { type: EntityType; name: string; + alias: string | null; parent_id: string | null; published: boolean; @@ -74,6 +75,7 @@ export class Category implements ICategory { @timestamp() readonly created_at!: Date readonly id!: string name!: string + alias!: string | null parent_id!: string | null type!: EntityType @timestamp() readonly updated_at!: Date @@ -94,6 +96,7 @@ export class Category implements ICategory { export type CategorySortFields = 'name' | 'parent_id' export interface ListCategoriesQuery extends PaginatedQuery, SortableQuery { name?: string + alias?: string search?: string published?: QueryBoolean searchable?: QueryBoolean @@ -122,6 +125,7 @@ export interface CreateCategoryParams extends Partial { } export interface UpdateCategoryParams extends Partial { + alias?: string ordering?: 'up' | 'down' } diff --git a/src/modules/content.ts b/src/modules/content.ts index bdc1d7a..2a2c965 100644 --- a/src/modules/content.ts +++ b/src/modules/content.ts @@ -22,10 +22,13 @@ export interface IContentItem extends Entity { content: string ordering: number published: boolean + alias: string category: ICategory } -export type UpdateContentItemParams = Partial & { ordering?: ReorderCommand } +export type UpdateContentItemParams = Partial & + { ordering?: ReorderCommand } & + { alias?: string } export interface CreateContentItemParams { title: string @@ -38,6 +41,7 @@ export type ContentSort = 'title' | 'ordering' | 'created_at' | 'updated_at' export interface ListContentsQuery extends PaginatedQuery, SortableQuery { published?: QueryBoolean title?: string + alias?: string category?: string search?: string } @@ -95,6 +99,7 @@ export class ContentItem implements IContentItem, Imagable { readonly id!: string; ordering!: number; published!: boolean; + alias!: string; title!: string; readonly type!: EntityType; @timestamp() readonly updated_at!: Date;