feat: added name in attach tag

This commit is contained in:
=
2024-08-09 14:38:15 +05:30
parent 5176e70437
commit 1fc18fe23b
3 changed files with 18 additions and 16 deletions
@@ -81,6 +81,7 @@ export const registerSecretTagRouter = async (server: FastifyZodProvider) => {
}), }),
response: { response: {
200: z.object({ 200: z.object({
// akhilmhdh: for terraform backward compatiability
workspaceTag: SecretTagsSchema.extend({ name: z.string() }) workspaceTag: SecretTagsSchema.extend({ name: z.string() })
}) })
} }
+16 -15
View File
@@ -59,9 +59,10 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
tags: SecretTagsSchema.pick({ tags: SecretTagsSchema.pick({
id: true, id: true,
slug: true, slug: true,
name: true,
color: true color: true
}).array() })
.extend({ name: z.string() })
.array()
}) })
) )
}) })
@@ -116,16 +117,15 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
}), }),
response: { response: {
200: z.object({ 200: z.object({
secret: SecretsSchema.omit({ secretBlindIndex: true }).merge( secret: SecretsSchema.omit({ secretBlindIndex: true }).extend({
z.object({ tags: SecretTagsSchema.pick({
tags: SecretTagsSchema.pick({ id: true,
id: true, slug: true,
slug: true, color: true
name: true,
color: true
}).array()
}) })
) .extend({ name: z.string() })
.array()
})
}) })
} }
}, },
@@ -196,9 +196,9 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
tags: SecretTagsSchema.pick({ tags: SecretTagsSchema.pick({
id: true, id: true,
slug: true, slug: true,
name: true,
color: true color: true
}) })
.extend({ name: z.string() })
.array() .array()
.optional() .optional()
}) })
@@ -332,9 +332,9 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
tags: SecretTagsSchema.pick({ tags: SecretTagsSchema.pick({
id: true, id: true,
slug: true, slug: true,
name: true,
color: true color: true
}) })
.extend({ name: z.string() })
.array() .array()
.optional() .optional()
}) })
@@ -738,9 +738,10 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
tags: SecretTagsSchema.pick({ tags: SecretTagsSchema.pick({
id: true, id: true,
slug: true, slug: true,
name: true,
color: true color: true
}).array() })
.extend({ name: z.string() })
.array()
}) })
.array(), .array(),
imports: z imports: z
@@ -2086,7 +2086,7 @@ export const secretServiceFactory = ({
return { return {
...updatedSecret[0], ...updatedSecret[0],
tags: [...existingSecretTags, ...tags].map((t) => ({ id: t.id, slug: t.slug, color: t.color })) tags: [...existingSecretTags, ...tags].map((t) => ({ id: t.id, slug: t.slug, name: t.slug, color: t.color }))
}; };
}; };