-
Notifications
You must be signed in to change notification settings - Fork 1
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
Feature/tgyuu/#69 #73
Changes from 23 commits
2e8b297
19ea0a1
a6307fa
c90a384
f6d90d0
b0806c4
7a7e3b8
41fe35a
7462c96
3dd2a56
e556a44
55682ba
5dc38dc
a0d381b
533d391
4b666eb
2cae0bf
22f257b
288da2a
d45b4ce
92241e1
ce1e79c
ba26ef5
6af73f3
5163eaa
f285487
a11d247
7e6b4bc
3f87779
fc17542
f027b29
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
package com.wap.wapp.core.model.event | ||
|
||
import java.time.LocalDate | ||
import java.time.LocalDateTime | ||
|
||
data class Event( | ||
val content: String, | ||
val eventId: Int, | ||
val eventId: String, | ||
val location: String, | ||
val period: LocalDate, | ||
val title: String, | ||
val time: String = "", | ||
val startDateTime: LocalDateTime, | ||
val endDateTime: LocalDateTime, | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
package com.wap.wapp.core.network.source.event | ||
|
||
import com.wap.wapp.core.network.model.event.EventRequest | ||
import com.wap.wapp.core.network.model.event.EventResponse | ||
import java.time.LocalDate | ||
|
||
interface EventDataSource { | ||
suspend fun getMonthEvents(date: LocalDate): Result<List<EventResponse>> | ||
suspend fun postEvent(date: LocalDate, eventRequest: EventRequest): Result<Unit> | ||
suspend fun postEvent( | ||
title: String, | ||
content: String, | ||
location: String, | ||
startDateTime: String, | ||
endDateTime: String, | ||
): Result<Unit> | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,9 +3,11 @@ package com.wap.wapp.core.network.source.event | |
import com.google.firebase.firestore.FirebaseFirestore | ||
import com.google.firebase.firestore.ktx.toObject | ||
import com.wap.wapp.core.network.constant.EVENT_COLLECTION | ||
import com.wap.wapp.core.network.constant.SURVEY_COLLECTION | ||
import com.wap.wapp.core.network.model.event.EventRequest | ||
import com.wap.wapp.core.network.model.event.EventResponse | ||
import com.wap.wapp.core.network.utils.await | ||
import com.wap.wapp.core.network.utils.toISOLocalDateTime | ||
import java.time.LocalDate | ||
import java.time.format.DateTimeFormatter | ||
import javax.inject.Inject | ||
|
@@ -32,12 +34,29 @@ class EventDataSourceImpl @Inject constructor( | |
result | ||
} | ||
|
||
override suspend fun postEvent(date: LocalDate, eventRequest: EventRequest): Result<Unit> = | ||
override suspend fun postEvent( | ||
title: String, | ||
content: String, | ||
location: String, | ||
startDateTime: String, | ||
endDateTime: String, | ||
): Result<Unit> = | ||
runCatching { | ||
val documentId = firebaseFirestore.collection(SURVEY_COLLECTION).document().id | ||
|
||
val eventRequest = EventRequest( | ||
title = title, | ||
content = content, | ||
location = location, | ||
startDateTime = startDateTime, | ||
endDateTime = endDateTime, | ||
eventId = documentId, | ||
) | ||
|
||
firebaseFirestore.collection(EVENT_COLLECTION) | ||
.document(getMonth(date)) | ||
.document(getMonth(startDateTime.toISOLocalDateTime().toLocalDate())) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ํด๋น ์ฝ๋ ๊ดํธ๋๋ฌธ์ ์์๋ณด๊ธฐ ์ฝ์ง ์์๋ฐ, startDateTime ~ toLocalDate ๊น์ง ๋ณ์๋ก ๋นผ๋ฒ๋ฆฌ๋ ๊ฑด ์ด๋์ ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ์์ฃผ ์ข์ ์๊ฐ์ ๋๋ค ์งํธ์. ์์ ํด๋์๊ฒ์! |
||
.collection(EVENT_COLLECTION) | ||
.document() | ||
.document(documentId) | ||
.set(eventRequest) | ||
.await() | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,14 +4,17 @@ import com.wap.wapp.core.model.survey.SurveyAnswer | |
import com.wap.wapp.core.network.model.survey.SurveyResponse | ||
|
||
interface SurveyDataSource { | ||
suspend fun isSubmittedSurvey(eventId: Int, userId: String): Result<Boolean> | ||
suspend fun isSubmittedSurvey( | ||
eventId: String, | ||
userId: String, | ||
): Result<Boolean> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ์ด์ ๋ถํฐ ๊ฐํ์ ๊ณ์ ํ์๋๋ฐ, ๋ฐ๋ก ๊ฐํํ์๋ ์ด์ ๊ฐ ์์๊น์?? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ์ ๊ฐํ ๋ฌด์กฐ๊ฑด ํด์ผํ๋ ๊ฑด ์ค ์์์ด์........... ์ปจ๋ฒค์ ์ฝ์ด๋ณด๊ณ ์ค๊ฒ ์ต๋๋ค ใ ใ ใ ใ ใ ใ ํใ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ๏ฟฝํํ ํ๊ท์ ํท๊ฐ๋ฆฌ๊ฒ ์ ๊ฐ ์ ์ด๋จ๋ค์ ํํํํ ๊ทผ๋ฐ ์คํ๋ ค ๊ฐํํ๋ฉด, ๋งค๊ฐ๋ณ์ ์ธ์์ ๋ ์๋์ ์คํ๋ ค ๊ตฟ์ ๋๋ค ํํ |
||
|
||
suspend fun getSurveyList(): Result<List<SurveyResponse>> | ||
|
||
suspend fun getSurvey(surveyId: String): Result<SurveyResponse> | ||
|
||
suspend fun postSurvey( | ||
eventId: Int, | ||
eventId: String, | ||
userId: String, | ||
title: String, | ||
content: String, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ํด๋น ๋ก์ง์ผ๋ก, data ๋ชจ๋์์๋ 3๋ฒ ํฌ๋งทํ ์ฌ์ฉ๋์ด์
network์ฒ๋ผ ์ ํธ๋ก ๋นผ๋ฒ๋ฆฌ๋๊ฒ ์ด๋จ๊น์ ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DateUtil ๋ก ๋นผ๋๊ฒ ์ต๋๋ค!