update types for request body in secrets v2 api

This commit is contained in:
Maidul Islam
2023-01-01 11:18:00 -05:00
parent 939e9ba075
commit 776b4c2922
2 changed files with 10 additions and 7 deletions
+7 -4
View File
@@ -1,11 +1,14 @@
import { Omit } from 'utility-types';
import { Assign, Omit } from 'utility-types';
import { ISecret } from '../../models';
// User input for CRUD operations on secrets routes
export type SecretUserInput = Omit<ISecret, "user" | "version" | "environment" | "workspace">;
// Everything is required, except the omitted types
export type CreateSecretRequestBody = Omit<ISecret, "user" | "version" | "environment" | "workspace">;
// Omit the listed properties, then make everything optional and then make _id required
export type ModifySecretRequestBody = Assign<Partial<Omit<ISecret, "user" | "version" | "environment" | "workspace">>, { _id: string }>;
// Used for modeling sanitized secrets before uplaod. To be used for converting user input for uploading
export type SanitizedSecretModify = Partial<Omit<ISecret, "user" | "version" | "environment" | "workspace">>;
// Used for modeling sanitized secrets before create. To be used for converting user input for creating new secrets
// Everything is required, except the omitted types
export type SanitizedSecretForCreate = Omit<ISecret, "version" | "_id">;