mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-08 07:27:43 +00:00
feat: renamed defaultType to defaultProduct
This commit is contained in:
@@ -8,13 +8,13 @@ export async function up(knex: Knex): Promise<void> {
|
|||||||
if (hasTypeColumn && !hasDefaultTypeColumn) {
|
if (hasTypeColumn && !hasDefaultTypeColumn) {
|
||||||
await knex.schema.alterTable(TableName.Project, (t) => {
|
await knex.schema.alterTable(TableName.Project, (t) => {
|
||||||
t.string("type").nullable().alter();
|
t.string("type").nullable().alter();
|
||||||
t.string("defaultType").notNullable().defaultTo(ProjectType.SecretManager);
|
t.string("defaultProduct").notNullable().defaultTo(ProjectType.SecretManager);
|
||||||
});
|
});
|
||||||
|
|
||||||
await knex(TableName.Project).update({
|
await knex(TableName.Project).update({
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
// @ts-ignore this is because this field is created later
|
// @ts-ignore this is because this field is created later
|
||||||
defaultType: knex.raw(`
|
defaultProduct: knex.raw(`
|
||||||
CASE
|
CASE
|
||||||
WHEN "type" IS NULL OR "type" = '' THEN 'secret-manager'
|
WHEN "type" IS NULL OR "type" = '' THEN 'secret-manager'
|
||||||
ELSE "type"
|
ELSE "type"
|
||||||
@@ -32,10 +32,10 @@ export async function up(knex: Knex): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function down(knex: Knex): Promise<void> {
|
export async function down(knex: Knex): Promise<void> {
|
||||||
const hasDefaultTypeColumn = await knex.schema.hasColumn(TableName.Project, "defaultType");
|
const hasDefaultTypeColumn = await knex.schema.hasColumn(TableName.Project, "defaultProduct");
|
||||||
if (hasDefaultTypeColumn) {
|
if (hasDefaultTypeColumn) {
|
||||||
await knex.schema.alterTable(TableName.Project, (t) => {
|
await knex.schema.alterTable(TableName.Project, (t) => {
|
||||||
t.dropColumn("defaultType");
|
t.dropColumn("defaultProduct");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ export const ProjectsSchema = z.object({
|
|||||||
hasDeleteProtection: z.boolean().default(false).nullable().optional(),
|
hasDeleteProtection: z.boolean().default(false).nullable().optional(),
|
||||||
secretSharing: z.boolean().default(true),
|
secretSharing: z.boolean().default(true),
|
||||||
showSnapshotsLegacy: z.boolean().default(false),
|
showSnapshotsLegacy: z.boolean().default(false),
|
||||||
defaultType: z.string().default("secret-manager")
|
defaultProduct: z.string().default("secret-manager")
|
||||||
});
|
});
|
||||||
|
|
||||||
export type TProjects = z.infer<typeof ProjectsSchema>;
|
export type TProjects = z.infer<typeof ProjectsSchema>;
|
||||||
|
|||||||
@@ -700,7 +700,8 @@ export const PROJECTS = {
|
|||||||
slug: "An optional slug for the project. (must be unique within the organization)",
|
slug: "An optional slug for the project. (must be unique within the organization)",
|
||||||
hasDeleteProtection: "Enable or disable delete protection for the project.",
|
hasDeleteProtection: "Enable or disable delete protection for the project.",
|
||||||
secretSharing: "Enable or disable secret sharing for the project.",
|
secretSharing: "Enable or disable secret sharing for the project.",
|
||||||
showSnapshotsLegacy: "Enable or disable legacy snapshots for the project."
|
showSnapshotsLegacy: "Enable or disable legacy snapshots for the project.",
|
||||||
|
defaultProduct: "The default product in which the project will open"
|
||||||
},
|
},
|
||||||
GET_KEY: {
|
GET_KEY: {
|
||||||
workspaceId: "The ID of the project to get the key from."
|
workspaceId: "The ID of the project to get the key from."
|
||||||
|
|||||||
@@ -251,7 +251,7 @@ export const SanitizedProjectSchema = ProjectsSchema.pick({
|
|||||||
name: true,
|
name: true,
|
||||||
description: true,
|
description: true,
|
||||||
type: true,
|
type: true,
|
||||||
defaultType: true,
|
defaultProduct: true,
|
||||||
slug: true,
|
slug: true,
|
||||||
autoCapitalization: true,
|
autoCapitalization: true,
|
||||||
orgId: true,
|
orgId: true,
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ import {
|
|||||||
SecretFoldersSchema,
|
SecretFoldersSchema,
|
||||||
SortDirection,
|
SortDirection,
|
||||||
UserEncryptionKeysSchema,
|
UserEncryptionKeysSchema,
|
||||||
UsersSchema
|
UsersSchema,
|
||||||
|
ProjectType
|
||||||
} from "@app/db/schemas";
|
} from "@app/db/schemas";
|
||||||
import { ProjectMicrosoftTeamsConfigsSchema } from "@app/db/schemas/project-microsoft-teams-configs";
|
import { ProjectMicrosoftTeamsConfigsSchema } from "@app/db/schemas/project-microsoft-teams-configs";
|
||||||
import { EventType } from "@app/ee/services/audit-log/audit-log-types";
|
import { EventType } from "@app/ee/services/audit-log/audit-log-types";
|
||||||
@@ -365,7 +366,8 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {
|
|||||||
.optional()
|
.optional()
|
||||||
.describe(PROJECTS.UPDATE.slug),
|
.describe(PROJECTS.UPDATE.slug),
|
||||||
secretSharing: z.boolean().optional().describe(PROJECTS.UPDATE.secretSharing),
|
secretSharing: z.boolean().optional().describe(PROJECTS.UPDATE.secretSharing),
|
||||||
showSnapshotsLegacy: z.boolean().optional().describe(PROJECTS.UPDATE.showSnapshotsLegacy)
|
showSnapshotsLegacy: z.boolean().optional().describe(PROJECTS.UPDATE.showSnapshotsLegacy),
|
||||||
|
defaultProduct: z.nativeEnum(ProjectType).optional().describe(PROJECTS.UPDATE.defaultProduct)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
200: z.object({
|
200: z.object({
|
||||||
@@ -384,6 +386,7 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {
|
|||||||
name: req.body.name,
|
name: req.body.name,
|
||||||
description: req.body.description,
|
description: req.body.description,
|
||||||
autoCapitalization: req.body.autoCapitalization,
|
autoCapitalization: req.body.autoCapitalization,
|
||||||
|
defaultProduct: req.body.defaultProduct,
|
||||||
hasDeleteProtection: req.body.hasDeleteProtection,
|
hasDeleteProtection: req.body.hasDeleteProtection,
|
||||||
slug: req.body.slug,
|
slug: req.body.slug,
|
||||||
secretSharing: req.body.secretSharing,
|
secretSharing: req.body.secretSharing,
|
||||||
|
|||||||
@@ -651,6 +651,7 @@ export const projectServiceFactory = ({
|
|||||||
hasDeleteProtection: update.hasDeleteProtection,
|
hasDeleteProtection: update.hasDeleteProtection,
|
||||||
slug: update.slug,
|
slug: update.slug,
|
||||||
secretSharing: update.secretSharing,
|
secretSharing: update.secretSharing,
|
||||||
|
defaultProduct: update.defaultProduct,
|
||||||
showSnapshotsLegacy: update.showSnapshotsLegacy
|
showSnapshotsLegacy: update.showSnapshotsLegacy
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ export type TUpdateProjectDTO = {
|
|||||||
description?: string;
|
description?: string;
|
||||||
autoCapitalization?: boolean;
|
autoCapitalization?: boolean;
|
||||||
hasDeleteProtection?: boolean;
|
hasDeleteProtection?: boolean;
|
||||||
|
defaultProduct?: ProjectType;
|
||||||
slug?: string;
|
slug?: string;
|
||||||
secretSharing?: boolean;
|
secretSharing?: boolean;
|
||||||
showSnapshotsLegacy?: boolean;
|
showSnapshotsLegacy?: boolean;
|
||||||
|
|||||||
Reference in New Issue
Block a user