49 lines
1.3 KiB
TypeScript
49 lines
1.3 KiB
TypeScript
/**
|
|
* Comments under a dump, and the bodies that post and edit them.
|
|
*
|
|
* @module
|
|
*/
|
|
|
|
/** A comment, with what the thread shows of its author. */
|
|
export interface Comment {
|
|
/** The comment's id. */
|
|
id: string;
|
|
/** The id of the dump it is posted under. */
|
|
dumpId: string;
|
|
/** The author's id. */
|
|
userId: string;
|
|
/** The id of the comment it replies to; undefined at the top level. */
|
|
parentId?: string;
|
|
/** The comment, in Markdown; empty once deleted. */
|
|
body: string;
|
|
/** When the comment was posted. */
|
|
createdAt: Date;
|
|
/** When the comment was last edited, if ever. */
|
|
updatedAt?: Date;
|
|
/**
|
|
* Whether the comment was deleted: it stays in the thread, emptied, so its
|
|
* replies keep their place.
|
|
*/
|
|
deleted: boolean;
|
|
/** How many users like the comment. */
|
|
likeCount: number;
|
|
/** The author's name. */
|
|
authorUsername: string;
|
|
/** The author's avatar type, undefined without one. */
|
|
authorAvatarMime?: string;
|
|
}
|
|
|
|
/** The body of `POST /api/dumps/:dumpId/comments`. */
|
|
export interface CreateCommentRequest {
|
|
/** The comment, in Markdown. */
|
|
body: string;
|
|
/** The id of the comment it replies to, for a reply. */
|
|
parentId?: string;
|
|
}
|
|
|
|
/** The body of `PATCH /api/comments/:commentId`. */
|
|
export interface UpdateCommentRequest {
|
|
/** The new text, in Markdown. */
|
|
body: string;
|
|
}
|