@@ -56,6 +56,25 @@ class CampaignRepository {
5656 return response. result
5757 }
5858
59+ func getCampaignByReporter(
60+ sort: SortType = . popular,
61+ page: Int = 0
62+ ) async throws -> PageableResponse < CampaignDTO > {
63+ do {
64+ let query : [ String : String ] = [
65+ " sort " : sort. rawValue,
66+ " page " : " \( page) " ,
67+ ]
68+
69+ let response : APIResponse < PageableResponse < CampaignDTO > > = try await networkAPI. request ( CampaignEndpoint . getCampaignByReporter, queryParameters: query)
70+ return response. result
71+ } catch {
72+ print ( " CampaignRepository Error: \( error) " )
73+ throw error
74+ }
75+ }
76+
77+
5978 /// - Note: HomeView 내부 `제품` 탭에서 호출합니다.
6079 func getCampaignByProduct(
6180 _ product: [ ProductCategory ] = [ ] ,
@@ -79,7 +98,7 @@ class CampaignRepository {
7998
8099 /// - Note: HomeView 내부 `SNS 플랫폼` 탭에서 호출합니다.
81100 func getCampaignBySNSPlatform(
82- _ snsPlatform: [ SocialPlatformType ] = [ ] ,
101+ _ snsPlatform: [ SNSPlatformType ] = [ ] ,
83102 sort: SortType = . popular,
84103 page: Int = 0
85104 ) async throws -> PageableResponse < CampaignDTO > {
@@ -100,7 +119,7 @@ class CampaignRepository {
100119
101120 /// - Note: HomeView 내부 `캠페인 플랫폼` 탭에서 호출합니다.
102121 func getCampaignByCampaignPlatform(
103- _ campaignPlatform: [ CampaignPlatformType ] = [ ] ,
122+ _ campaignPlatform: [ CampaignPlatform ] = [ ] ,
104123 sort: SortType = . popular,
105124 page: Int = 0
106125 ) async throws -> PageableResponse < CampaignDTO > {
@@ -110,7 +129,7 @@ class CampaignRepository {
110129 ]
111130
112131 if !campaignPlatform. isEmpty {
113- query [ " platform " ] = campaignPlatform. map { $0. imageName } . joined ( separator: " , " )
132+ query [ " platform " ] = campaignPlatform. map { $0. siteNameEn } . joined ( separator: " , " )
114133 } else {
115134 query [ " platform " ] = " all "
116135 }
@@ -132,7 +151,6 @@ class CampaignRepository {
132151 }
133152 }
134153
135-
136154 /// - Note: SearchView 내부 `검색 단계`에서 호출합니다.
137155 func searchCampaign( _ keyword: String ) async throws -> [ CampaignDTO ] {
138156 let query = [ " keyword " : keyword]
@@ -154,8 +172,8 @@ class CampaignRepository {
154172 subRegions: [ SubRegion ] = [ ] ,
155173 local: [ LocalCategory ] = [ ] ,
156174 product: [ ProductCategory ] = [ ] ,
157- snsPlatform: [ SocialPlatformType ] = [ ] ,
158- campaignPlatform: [ CampaignPlatformType ] = [ ] ,
175+ snsPlatform: [ SNSPlatformType ] = [ ] ,
176+ campaignPlatform: [ CampaignPlatform ] = [ ] ,
159177 sort: SortType = . popular,
160178 page: Int = 0 ,
161179 focusedCategory: CampaignType ? = nil ,
@@ -204,7 +222,7 @@ class CampaignRepository {
204222 }
205223 case . campaignPlatform:
206224 if !campaignPlatform. isEmpty {
207- queryParameters [ " campaignPlatform " ] = campaignPlatform. map { $0. imageName } . joined ( separator: " , " )
225+ queryParameters [ " campaignPlatform " ] = campaignPlatform. map { $0. siteNameEn } . joined ( separator: " , " )
208226 } else {
209227 queryParameters [ " campaignPlatform " ] = " all "
210228 }
@@ -225,7 +243,7 @@ class CampaignRepository {
225243 queryParameters [ " snsPlatform " ] = " all "
226244 }
227245 if !campaignPlatform. isEmpty {
228- queryParameters [ " campaignPlatform " ] = campaignPlatform. map { $0. imageName } . joined ( separator: " , " )
246+ queryParameters [ " campaignPlatform " ] = campaignPlatform. map { $0. siteNameEn } . joined ( separator: " , " )
229247 } else {
230248 queryParameters [ " campaignPlatform " ] = " all "
231249 }
0 commit comments