npm run build durch gelaufen

This commit is contained in:
Timo Knuth 2026-02-28 11:56:31 +01:00
parent aec4b93439
commit 02bb2ed994
6 changed files with 18 additions and 24 deletions

View File

@ -33,6 +33,7 @@ RUN pnpm --filter @innungsapp/shared prisma:generate
# Build the admin app # Build the admin app
ENV NEXT_TELEMETRY_DISABLED=1 ENV NEXT_TELEMETRY_DISABLED=1
ENV DOCKER_BUILD=1
RUN pnpm --filter @innungsapp/admin build RUN pnpm --filter @innungsapp/admin build
# ============================================= # =============================================

View File

@ -73,6 +73,7 @@ const createOrgSchema = z.object({
landingPageHeroImage: z.string().optional().nullable(), landingPageHeroImage: z.string().optional().nullable(),
landingPageHeroOverlayOpacity: z.number().min(0).max(100).optional().default(50), landingPageHeroOverlayOpacity: z.number().min(0).max(100).optional().default(50),
landingPageFeatures: z.string().optional(), landingPageFeatures: z.string().optional(),
landingPageFooter: z.string().optional(),
landingPageSectionTitle: z.string().optional(), landingPageSectionTitle: z.string().optional(),
landingPageButtonText: z.string().optional(), landingPageButtonText: z.string().optional(),
appStoreUrl: z.string().url('Ungueltige URL').optional().or(z.literal('')), appStoreUrl: z.string().url('Ungueltige URL').optional().or(z.literal('')),
@ -90,6 +91,7 @@ const updateOrgSchema = z.object({
landingPageText: z.string().optional(), landingPageText: z.string().optional(),
landingPageHeroImage: z.string().optional().nullable(), landingPageHeroImage: z.string().optional().nullable(),
landingPageFeatures: z.string().optional(), landingPageFeatures: z.string().optional(),
landingPageFooter: z.string().optional(),
landingPageSectionTitle: z.string().optional(), landingPageSectionTitle: z.string().optional(),
landingPageButtonText: z.string().optional(), landingPageButtonText: z.string().optional(),
appStoreUrl: z.string().url('Ungueltige URL').optional().or(z.literal('')), appStoreUrl: z.string().url('Ungueltige URL').optional().or(z.literal('')),

View File

@ -12,8 +12,8 @@ export default async function LandingPagesOverview({
const organizations = await prisma.organization.findMany({ const organizations = await prisma.organization.findMany({
where: q ? { where: q ? {
OR: [ OR: [
{ name: { contains: q, mode: 'insensitive' } }, { name: { contains: q } },
{ slug: { contains: q, mode: 'insensitive' } }, { slug: { contains: q } },
] ]
} : {}, } : {},
orderBy: { name: 'asc' }, orderBy: { name: 'asc' },

View File

@ -32,9 +32,9 @@ export default async function SuperAdminPage({
const where = q const where = q
? { ? {
OR: [ OR: [
{ name: { contains: q, mode: 'insensitive' } }, { name: { contains: q } },
{ slug: { contains: q, mode: 'insensitive' } }, { slug: { contains: q } },
{ contactEmail: { contains: q, mode: 'insensitive' } }, { contactEmail: { contains: q } },
], ],
} }
: {} : {}

View File

@ -2,7 +2,7 @@ import type { NextConfig } from 'next'
const nextConfig: NextConfig = { const nextConfig: NextConfig = {
transpilePackages: ['@innungsapp/shared'], transpilePackages: ['@innungsapp/shared'],
output: 'standalone', output: process.env.DOCKER_BUILD ? 'standalone' : undefined,
experimental: {}, experimental: {},
webpack: (config, { dev }) => { webpack: (config, { dev }) => {
if (dev) { if (dev) {

View File

@ -41,17 +41,7 @@ async function createUserDirectly(opts: { email: string; name: string; password:
mustChangePassword: opts.mustChangePassword ?? false, mustChangePassword: opts.mustChangePassword ?? false,
}, },
}) })
// Try better-auth API first (guaranteed correct hash format). await createCredentialAccount(userId, opts.password)
// Falls back to direct DB write if API fails (e.g. admin permissions not available).
try {
const authHeaders = await getSanitizedHeaders()
await auth.api.updateUser({
body: { userId, password: opts.password },
headers: authHeaders,
})
} catch {
await createCredentialAccount(userId, opts.password)
}
return { id: userId } return { id: userId }
} }
@ -148,8 +138,8 @@ export const membersRouter = router({
if (callerHasAccess) { if (callerHasAccess) {
const ur = memberAnyOrg.userId const ur = memberAnyOrg.userId
? await ctx.prisma.userRole.findUnique({ ? await ctx.prisma.userRole.findUnique({
where: { orgId_userId: { orgId: memberAnyOrg.orgId, userId: memberAnyOrg.userId } } where: { orgId_userId: { orgId: memberAnyOrg.orgId, userId: memberAnyOrg.userId } }
}) })
: null : null
return { ...memberAnyOrg, role: ur?.role ?? 'member' } return { ...memberAnyOrg, role: ur?.role ?? 'member' }
} }
@ -226,7 +216,7 @@ export const membersRouter = router({
// 1. Create the member record // 1. Create the member record
const member = await ctx.prisma.member.create({ const member = await ctx.prisma.member.create({
data: { ...rest, orgId: ctx.orgId }, data: { ...rest, orgId: ctx.orgId } as any,
}) })
// 2. Create a User account if a password was provided OR role is 'admin', // 2. Create a User account if a password was provided OR role is 'admin',
@ -256,8 +246,9 @@ export const membersRouter = router({
where: { userId, providerId: 'credential' } where: { userId, providerId: 'credential' }
}) })
if (credAccount) { if (credAccount) {
// Credential account exists — update the password via Better Auth // Credential account exists — update the password hash directly
await auth.api.updateUser({ body: { userId, password, name: input.name }, headers: authHeaders }) const newHash = await hashPassword(password)
await ctx.prisma.account.update({ where: { id: credAccount.id }, data: { password: newHash } })
} else { } else {
// No credential account yet — create one directly in the DB // No credential account yet — create one directly in the DB
await createCredentialAccount(userId, password) await createCredentialAccount(userId, password)
@ -292,7 +283,7 @@ export const membersRouter = router({
// 1. Create member record // 1. Create member record
const member = await ctx.prisma.member.create({ const member = await ctx.prisma.member.create({
data: { ...memberData, orgId: ctx.orgId }, data: { ...memberData, orgId: ctx.orgId } as any,
}) })
const org = await ctx.prisma.organization.findUniqueOrThrow({ const org = await ctx.prisma.organization.findUniqueOrThrow({
@ -350,7 +341,7 @@ export const membersRouter = router({
where: { id: member.id }, where: { id: member.id },
data: { userId: targetUserId } data: { userId: targetUserId }
}) })
if (role === 'admin') { if (role === 'admin') {
await ctx.prisma.userRole.upsert({ await ctx.prisma.userRole.upsert({
where: { orgId_userId: { orgId: ctx.orgId, userId: targetUserId } }, where: { orgId_userId: { orgId: ctx.orgId, userId: targetUserId } },