feat: universal types for rust and ts

This commit is contained in:
PandaDEV 2024-12-11 14:30:04 +10:00
parent a94496dbdb
commit ed0dfa41ae
No known key found for this signature in database
GPG key ID: 13EFF9BAF70EE75C
2 changed files with 94 additions and 29 deletions

View file

@ -1,21 +1,35 @@
export interface HistoryItem {
import { v4 as uuidv4 } from 'uuid';
export enum ContentType {
Text = "text",
Image = "image",
File = "file",
Link = "link",
Color = "color",
Code = "code",
}
export class HistoryItem {
id: string;
content_type: ContentType;
content: string;
favicon: string;
favicon?: string;
timestamp: Date;
constructor(content_type: ContentType, content: string, favicon?: string) {
this.id = uuidv4();
this.content_type = content_type;
this.content = content;
this.favicon = favicon;
this.timestamp = new Date();
}
toRow(): [string, string, string, string | undefined, Date] {
return [this.id, this.content_type, this.content, this.favicon, this.timestamp];
}
}
export interface Settings {
key: string;
value: string;
}
export enum ContentType {
TEXT,
IMAGE,
FILE,
LINK,
COLOR,
CODE,
}