mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-07-06 22:45:24 +02:00
Update better-auth dependency to version 1.2.8 and enhance license key validation in the API to require at least one of enableEnterpriseFeatures or licenseKey.
This commit is contained in:
@@ -35,15 +35,22 @@ export const licenseKeyRouter = createTRPCRouter({
|
||||
.mutation(async ({ ctx, input }) => {
|
||||
const currentUserId = ctx.user.id;
|
||||
|
||||
if (
|
||||
input.enableEnterpriseFeatures === undefined &&
|
||||
input.licenseKey === undefined
|
||||
) {
|
||||
throw new TRPCError({
|
||||
code: "BAD_REQUEST",
|
||||
message:
|
||||
"At least one of enableEnterpriseFeatures or licenseKey must be provided",
|
||||
});
|
||||
}
|
||||
|
||||
await db
|
||||
.update(user)
|
||||
.set({
|
||||
...(input.enableEnterpriseFeatures === undefined
|
||||
? {}
|
||||
: { enableEnterpriseFeatures: input.enableEnterpriseFeatures }),
|
||||
...(input.licenseKey === undefined
|
||||
? {}
|
||||
: { licenseKey: input.licenseKey }),
|
||||
// enableEnterpriseFeatures: input.enableEnterpriseFeatures ?? false,
|
||||
licenseKey: input.licenseKey ?? "",
|
||||
})
|
||||
.where(eq(user.id, currentUserId));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user