feat(bitbucket): add bitbucketEmail field to Bitbucket provider settings and update related API and database schema

This commit is contained in:
Mauricio Siu
2025-09-21 13:54:53 -06:00
parent 0a789e1d6f
commit 063d51e442
8 changed files with 6767 additions and 52 deletions
+17 -8
View File
@@ -68,17 +68,26 @@ export const updateBitbucket = async (
input: typeof apiUpdateBitbucket._type,
) => {
return await db.transaction(async (tx) => {
// Explicitly omit credentials from updates for safety/back-compat
const {
apiToken: _ignoredApiToken,
appPassword: _ignoredAppPassword,
...safeInput
} = input as any;
// First get the current bitbucket provider to get gitProviderId
const currentProvider = await tx.query.bitbucket.findFirst({
where: eq(bitbucket.bitbucketId, bitbucketId),
});
if (!currentProvider) {
throw new TRPCError({
code: "NOT_FOUND",
message: "Bitbucket provider not found",
});
}
const result = await tx
.update(bitbucket)
.set({
...safeInput,
bitbucketUsername: input.bitbucketUsername,
bitbucketEmail: input.bitbucketEmail,
appPassword: input.appPassword,
apiToken: input.apiToken,
bitbucketWorkspaceName: input.bitbucketWorkspaceName,
})
.where(eq(bitbucket.bitbucketId, bitbucketId))
.returning();
@@ -90,7 +99,7 @@ export const updateBitbucket = async (
name: input.name,
organizationId: input.organizationId,
})
.where(eq(gitProvider.gitProviderId, input.gitProviderId))
.where(eq(gitProvider.gitProviderId, currentProvider.gitProviderId))
.returning();
}