diff --git a/apps/envited.ascs.digital/common/guards/guards.ts b/apps/envited.ascs.digital/common/guards/guards.ts index e0b9cc80..f2e0a428 100644 --- a/apps/envited.ascs.digital/common/guards/guards.ts +++ b/apps/envited.ascs.digital/common/guards/guards.ts @@ -1,4 +1,4 @@ -import { equals, pathOr, prop } from 'ramda' +import { equals, pathOr, prop, propOr } from 'ramda' import { Role, Session, User } from '../../common/types/types' @@ -12,7 +12,7 @@ export const isOwnUser = (user: User) => (session: Session) => export const userIsIssuedByLoggedInUser = (user: User) => (session: Session) => equals(prop('issuerId')(user))(pathOr('', ['user', 'pkh'])(session)) -export const isOwnProfile = (user: User) => (profile: { name: string }) => - equals(prop('name')(user))(prop('name')(profile)) +export const isOwnProfile = (user: User) => (profile: { name?: string }) => + equals(prop('name')(user))(propOr('', 'name')(profile)) export const isUsersCompanyProfile = isOwnProfile diff --git a/apps/envited.ascs.digital/common/serverActions/profiles/update.ts b/apps/envited.ascs.digital/common/serverActions/profiles/update.ts index 96a28677..72cb9fd4 100644 --- a/apps/envited.ascs.digital/common/serverActions/profiles/update.ts +++ b/apps/envited.ascs.digital/common/serverActions/profiles/update.ts @@ -11,7 +11,7 @@ import { badRequestError, error, unauthorizedError } from '../../utils' export const _update = ({ db, getServerSession }: { db: Database; getServerSession: () => Promise }) => - async (profile: Profile) => { + async (profile: Partial) => { try { const session = await getServerSession() if (isNil(session)) {