Files
gerbeur/shared/category.ts

43 lines
1.1 KiB
TypeScript

/**
* Categories, the admin-managed topics a dump can be filed under, and the
* bodies that create and edit them.
*
* @module
*/
/** A category, which lists its dumps at `/<slug>`. */
export interface Category {
/** The category's id. */
id: string;
/** The category's URL slug, at the site root. */
slug: string;
/** The category's display name. */
name: string;
/** The category's place in the list, ascending. */
position: number;
/** When the category was created. */
createdAt: Date;
/** When the category was last changed, if ever. */
updatedAt?: Date;
}
/** The body of `POST /api/categories`. */
export interface CreateCategoryRequest {
/** The new category's slug. */
slug: string;
/** The new category's display name. */
name: string;
/** Its place in the list; 0 when left out. */
position?: number;
}
/** The body of `PUT /api/categories/:id`: the fields to change. */
export interface UpdateCategoryRequest {
/** The new slug. */
slug?: string;
/** The new display name. */
name?: string;
/** The new place in the list. */
position?: number;
}