diff --git a/Projects/Core/NetworkKit/Sources/ProfileService/ProfileService.swift b/Projects/Core/NetworkKit/Sources/ProfileService/ProfileService.swift index 15c963f..749ca21 100644 --- a/Projects/Core/NetworkKit/Sources/ProfileService/ProfileService.swift +++ b/Projects/Core/NetworkKit/Sources/ProfileService/ProfileService.swift @@ -25,6 +25,8 @@ public protocol ProfileServiceProtocol { func requestPutPartnerInfo(userInfo: UserInfo) async throws + func requestResetProfileImage(imageId: String) async throws + func requestUploadImage(image: Data) async throws } @@ -103,6 +105,11 @@ extension ProfileService: ProfileServiceProtocol { return } + public func requestResetProfileImage(imageId: String) async throws { + let result = try await client.deleteProfileImage(path: .init(imageId: imageId)) + _ = try result.noContent + } + public func requestUploadImage(image: Data) async throws { // url 받기 let uploadUrlInfo = try await requestPresignedUrl() diff --git a/Projects/Core/NetworkKit/Sources/ProfileService/ProfileServiceMock.swift b/Projects/Core/NetworkKit/Sources/ProfileService/ProfileServiceMock.swift index a0e2a9f..40a136c 100644 --- a/Projects/Core/NetworkKit/Sources/ProfileService/ProfileServiceMock.swift +++ b/Projects/Core/NetworkKit/Sources/ProfileService/ProfileServiceMock.swift @@ -39,6 +39,11 @@ public final class ProfileServiceMock: ProfileServiceProtocol { return } + public func requestResetProfileImage(imageId: String) async throws { + print("✅ [ProfileServiceMock] requestResetProfileImage 성공!") + return + } + public func requestUploadImage(image: Data) async throws { print("✅ [ProfileServiceMock] requestUploadImage 성공!") return diff --git a/Projects/Model/Model/Sources/Auth/Domain/UserInfo.swift b/Projects/Model/Model/Sources/Auth/Domain/UserInfo.swift index f4fd65a..10ba0db 100644 --- a/Projects/Model/Model/Sources/Auth/Domain/UserInfo.swift +++ b/Projects/Model/Model/Sources/Auth/Domain/UserInfo.swift @@ -50,8 +50,9 @@ public struct UserInfo: Equatable, Identifiable, Hashable { self.profile = .init(from: dto.profile) self.dreamPartner = .init(from: dto.desiredPartner) self.profileWidgets = dto.profileWidgets.map { .init(from: $0) } - if let profileUrl = dto.profileImages?.first?.url { - self.profile.profileImageUrl = URL(string: profileUrl) + if let profileImage = dto.profileImages?.first { + self.profile.profileImageUrl = URL(string: profileImage.url) + self.profile.profileImageId = profileImage.id } } @@ -91,6 +92,7 @@ public struct UserInfoProfile: Hashable, Identifiable, Equatable { public var jobOccupationRawValue: String public var locations: [LocationModel] public var profileImageUrl: URL? + public var profileImageId: String? public var companyName: String { set { @@ -113,7 +115,8 @@ public struct UserInfoProfile: Hashable, Identifiable, Equatable { jobOccupation: String, jobOccupationRawValue: String, locations: [LocationModel], - profileImageUrl: URL? = nil + profileImageUrl: URL? = nil, + profileImageId: String? = nil ) { self.gender = gender self.birthYear = birthYear @@ -123,6 +126,7 @@ public struct UserInfoProfile: Hashable, Identifiable, Equatable { self.jobOccupationRawValue = jobOccupationRawValue self.locations = locations self.profileImageUrl = profileImageUrl + self.profileImageId = profileImageId } public init(from dto: Components.Schemas.UserProfileDisplayInfo) {