feat(server): added some more validation and feedback for deletion etc

This commit is contained in:
Akhil Mohan
2024-03-21 20:23:44 +05:30
parent e201e80a06
commit 70fe80414d
11 changed files with 255 additions and 68 deletions
@@ -19,9 +19,9 @@ export async function up(knex: Knex): Promise<void> {
t.string("algorithm").notNullable().defaultTo(SecretEncryptionAlgo.AES_256_GCM);
t.string("keyEncoding").notNullable().defaultTo(SecretKeyEncoding.UTF8);
t.uuid("folderId").notNullable();
t.boolean("isDeleting").defaultTo(false);
// used for flag why delete is failing
// for background process communication
t.string("status");
t.string("statusDetails");
t.foreign("folderId").references("id").inTable(TableName.SecretFolder).onDelete("CASCADE");
t.unique(["slug", "folderId"]);
t.timestamps(true, true, true);
@@ -36,8 +36,10 @@ export async function up(knex: Knex): Promise<void> {
t.uuid("id", { primaryKey: true }).defaultTo(knex.fn.uuid());
t.integer("version").notNullable();
t.string("externalEntityId").notNullable();
t.string("maxTTL");
t.datetime("expireAt").notNullable();
// for background process communication
t.string("status");
t.string("statusDetails");
t.uuid("dynamicSecretId").notNullable();
t.foreign("dynamicSecretId").references("id").inTable(TableName.DynamicSecret).onDelete("CASCADE");
t.timestamps(true, true, true);
@@ -11,8 +11,9 @@ export const DynamicSecretLeasesSchema = z.object({
id: z.string().uuid(),
version: z.number(),
externalEntityId: z.string(),
maxTTL: z.string().nullable().optional(),
expireAt: z.date(),
status: z.string().nullable().optional(),
statusDetails: z.string().nullable().optional(),
dynamicSecretId: z.string().uuid(),
createdAt: z.date(),
updatedAt: z.date()
+1 -1
View File
@@ -20,8 +20,8 @@ export const DynamicSecretsSchema = z.object({
algorithm: z.string().default("aes-256-gcm"),
keyEncoding: z.string().default("utf8"),
folderId: z.string().uuid(),
isDeleting: z.boolean().default(false).nullable().optional(),
status: z.string().nullable().optional(),
statusDetails: z.string().nullable().optional(),
createdAt: z.date(),
updatedAt: z.date()
});