2023-09-12 22:48:10 +02:00
|
|
|
import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from "typeorm";
|
|
|
|
|
import { APIEmoji } from "~types/entities/emoji";
|
|
|
|
|
|
2023-09-28 20:19:21 +02:00
|
|
|
/**
|
|
|
|
|
* Represents an emoji entity in the database.
|
|
|
|
|
*/
|
2023-09-12 22:48:10 +02:00
|
|
|
@Entity({
|
|
|
|
|
name: "emojis",
|
|
|
|
|
})
|
|
|
|
|
export class Emoji extends BaseEntity {
|
2023-09-28 20:19:21 +02:00
|
|
|
/**
|
|
|
|
|
* The unique identifier for the emoji.
|
|
|
|
|
*/
|
2023-09-12 22:48:10 +02:00
|
|
|
@PrimaryGeneratedColumn("uuid")
|
|
|
|
|
id!: string;
|
|
|
|
|
|
2023-09-28 20:19:21 +02:00
|
|
|
/**
|
|
|
|
|
* The shortcode for the emoji.
|
|
|
|
|
*/
|
2023-09-12 22:48:10 +02:00
|
|
|
@Column("varchar")
|
|
|
|
|
shortcode!: string;
|
|
|
|
|
|
2023-09-28 20:19:21 +02:00
|
|
|
/**
|
|
|
|
|
* The URL for the emoji.
|
|
|
|
|
*/
|
2023-09-12 22:48:10 +02:00
|
|
|
@Column("varchar")
|
|
|
|
|
url!: string;
|
|
|
|
|
|
2023-09-28 20:19:21 +02:00
|
|
|
/**
|
|
|
|
|
* Whether the emoji is visible in the picker.
|
|
|
|
|
*/
|
2023-09-12 22:48:10 +02:00
|
|
|
@Column("boolean")
|
|
|
|
|
visible_in_picker!: boolean;
|
|
|
|
|
|
2023-09-28 20:19:21 +02:00
|
|
|
/**
|
|
|
|
|
* Converts the emoji to an APIEmoji object.
|
|
|
|
|
* @returns The APIEmoji object.
|
|
|
|
|
*/
|
2023-09-12 22:48:10 +02:00
|
|
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
|
|
|
async toAPI(): Promise<APIEmoji> {
|
|
|
|
|
return {
|
|
|
|
|
shortcode: this.shortcode,
|
|
|
|
|
static_url: "",
|
|
|
|
|
url: "",
|
|
|
|
|
visible_in_picker: false,
|
|
|
|
|
category: undefined,
|
2023-09-13 02:29:13 +02:00
|
|
|
};
|
2023-09-12 22:48:10 +02:00
|
|
|
}
|
2023-09-13 02:29:13 +02:00
|
|
|
}
|