Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(user-profile): Remove user-profile V1 from api layer #17249

Merged
merged 2 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
282 changes: 0 additions & 282 deletions libs/api/domains/user-profile/src/lib/V1/userProfile.service.ts

This file was deleted.

60 changes: 33 additions & 27 deletions libs/api/domains/user-profile/src/lib/V2/userProfile.service.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
import { BadRequestException, Injectable } from '@nestjs/common'
import { Injectable } from '@nestjs/common'

import { Auth, AuthMiddleware, User } from '@island.is/auth-nest-tools'
import {
ConfirmationDtoResponse,
UserProfileControllerFindUserProfileClientTypeEnum,
PostNudgeDtoNudgeTypeEnum,
UserProfileControllerFindUserProfileClientTypeEnum,
V2MeApi,
V2UsersApi,
} from '@island.is/clients/user-profile'
import { Auth, AuthMiddleware, User } from '@island.is/auth-nest-tools'

import { IslykillService } from '../islykill.service'
import { UserProfile } from '../userProfile.model'
import { ApolloError } from 'apollo-server-express'
import { AdminUserProfile } from '../adminUserProfile.model'
import { ActorProfile, ActorProfileResponse } from '../dto/actorProfile'
import { UpdateUserProfileInput } from '../dto/updateUserProfileInput'
import { CreateSmsVerificationInput } from '../dto/createSmsVerificationInput'
import { CreateEmailVerificationInput } from '../dto/createEmalVerificationInput'
import { CreateSmsVerificationInput } from '../dto/createSmsVerificationInput'
import { DeleteIslykillValueInput } from '../dto/deleteIslykillValueInput'
import { UpdateActorProfileInput } from '../dto/updateActorProfileInput'
import { AdminUserProfile } from '../adminUserProfile.model'
import { UpdateUserProfileInput } from '../dto/updateUserProfileInput'
import { IslykillService } from '../islykill.service'
import { DeleteIslykillSettings } from '../models/deleteIslykillSettings.model'
import { UserProfile } from '../userProfile.model'

@Injectable()
export class UserProfileServiceV2 {
Expand Down Expand Up @@ -134,24 +136,6 @@ export class UserProfileServiceV2 {
})
}

async confirmSms(): Promise<ConfirmationDtoResponse> {
throw new BadRequestException(
'For User Profile V2 call updateUserProfile instead with mobilePhoneNumberVerificationCode',
)
}

async confirmEmail(): Promise<ConfirmationDtoResponse> {
throw new BadRequestException(
'For User Profile V2 call updateUserProfile instead with emailVerificationCode',
)
}

async resendEmailVerification(): Promise<void> {
throw new BadRequestException(
'For User Profile V2 call createEmailVerification instead with email again',
)
}

async getUserProfiles(user: User, search: string) {
return this.v2UserProfileApiWithAuth(
user,
Expand Down Expand Up @@ -184,4 +168,26 @@ export class UserProfileServiceV2 {
patchUserProfileDto: input,
})
}

async deleteIslykillValue(
input: DeleteIslykillValueInput,
user: User,
): Promise<DeleteIslykillSettings> {
const { nationalId } = await this.updateMeUserProfile(
{
...(input.email && { email: '' }),
...(input.mobilePhoneNumber && { mobilePhoneNumber: '' }),
},
user,
)

if (!nationalId) {
throw new ApolloError('Failed to update user profile')
}

return {
nationalId,
valid: true,
}
}
}

This file was deleted.

This file was deleted.

Loading
Loading