42 lines
990 B
TypeScript
42 lines
990 B
TypeScript
/**
|
|
* Declares the categories that dumps are filed under, and the bodies that
|
|
* create and change them. Only admins manage categories, through the API, since
|
|
* no page does it. The client lists them in its `CategoriesProvider`.
|
|
*
|
|
* @module
|
|
*/
|
|
|
|
/**
|
|
* Returned by the category routes. A category's feed lives at `/<slug>` on the
|
|
* client, and a dump names its categories by `id` in `categoryIds`.
|
|
*/
|
|
export interface Category {
|
|
id: string;
|
|
slug: string;
|
|
name: string;
|
|
/** Sorts the categories, lowest first. */
|
|
position: number;
|
|
createdAt: Date;
|
|
updatedAt?: Date;
|
|
}
|
|
|
|
/**
|
|
* Passed to `POST /api/categories`. The slug must be free and not reserved by
|
|
* a route.
|
|
*/
|
|
export interface CreateCategoryRequest {
|
|
slug: string;
|
|
name: string;
|
|
/** 0 when left out. */
|
|
position?: number;
|
|
}
|
|
|
|
/**
|
|
* Passed to `PUT /api/categories/:id`. A field left out keeps its value.
|
|
*/
|
|
export interface UpdateCategoryRequest {
|
|
slug?: string;
|
|
name?: string;
|
|
position?: number;
|
|
}
|