- all entities export a kind field (credential/snippet/scenario) for safe type checking on import - import upserts by id: overwrites if id exists, creates with explicit id otherwise - scenario export now includes id and step ids; import deletes old steps before recreating - add GET /:id/export and POST /import endpoints to credential and snippet controllers - add UuidBadge ui component: shortens uuid to first+last 4 hex chars, tooltip, clipboard copy with animated ClipboardCheck icon pop - apply UuidBadge across all entity id display sites (detail pages, card footers, table columns) - add export/import buttons to CredentialsPage, SnippetsPage, CredentialDetailPage, SnippetDetailPage
40 lines
785 B
TypeScript
40 lines
785 B
TypeScript
import {
|
|
Entity,
|
|
PrimaryGeneratedColumn,
|
|
Column,
|
|
CreateDateColumn,
|
|
UpdateDateColumn,
|
|
} from "typeorm";
|
|
|
|
export type SessionStatus = "open" | "closed";
|
|
|
|
@Entity("sessions")
|
|
export class SessionEntity {
|
|
@PrimaryGeneratedColumn("uuid")
|
|
id: string;
|
|
|
|
@Column({ unique: true })
|
|
sessionName: string;
|
|
|
|
@Column("text")
|
|
token: string;
|
|
|
|
@Column("text")
|
|
cookies: string; // JSON-serialised Cookie[] from Playwright
|
|
|
|
@Column("text", { default: "{}" })
|
|
localStorage: string; // JSON-serialised Record<string, string> from Playwright
|
|
|
|
@Column({ default: "closed" })
|
|
status: SessionStatus;
|
|
|
|
@Column({ type: "datetime", nullable: true, default: null })
|
|
lastUsedAt: Date | null;
|
|
|
|
@CreateDateColumn()
|
|
createdAt: Date;
|
|
|
|
@UpdateDateColumn()
|
|
updatedAt: Date;
|
|
}
|