qudoco-fe/constants/article-content-types.ts

28 lines
691 B
TypeScript
Raw Permalink Normal View History

/** Maps to `articles.type_id` in the database. Image historically used 1. */
export const ARTICLE_TYPE = {
IMAGE: 1,
TEXT: 2,
VIDEO: 3,
AUDIO: 4,
} as const;
export type ArticleContentKind = "text" | "image" | "video" | "audio";
export const ARTICLE_KIND_TO_TYPE_ID: Record<ArticleContentKind, number> = {
image: ARTICLE_TYPE.IMAGE,
text: ARTICLE_TYPE.TEXT,
video: ARTICLE_TYPE.VIDEO,
audio: ARTICLE_TYPE.AUDIO,
};
export const ARTICLE_KIND_LABEL: Record<ArticleContentKind, string> = {
text: "Text",
image: "Image",
video: "Video",
audio: "Audio",
};
export function articleListPath(kind: ArticleContentKind): string {
return `/admin/news-article/${kind}`;
}