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

Feature/tgyuu/#69 #73

Merged
merged 31 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
2e8b297
[FEATURE] #69 : TimePicker ์ปค์Šคํ…€
tgyuuAn Dec 28, 2023
19ea0a1
[CHORE] #69 : TimePickerDialog ๋ถ„๋ฆฌ
tgyuuAn Dec 28, 2023
a6307fa
[FEATURE] #69 : DatePickerDialog ์บ˜๋ฆฐ๋” ์ด์‹
tgyuuAn Dec 28, 2023
c90a384
[FEATURE] #69 : DatePickerDialog ์บ˜๋ฆฐ๋” UI ๋ณด์™„
tgyuuAn Dec 28, 2023
f6d90d0
[FEATURE] #69 : ์„ค๋ฌธ์กฐ์‚ฌ ๋“ฑ๋ก UI ๋ณด์™„
tgyuuAn Dec 28, 2023
b0806c4
[FEATURE] #69 : ๊ด€๋ฆฌ ํŽ˜์ด์ง€ UI ๋ณด์™„
tgyuuAn Dec 28, 2023
7a7e3b8
[FEATURE] #69 : WappDatePickerDialog ์™„์„ฑ
tgyuuAn Dec 28, 2023
41fe35a
[FEATURE] #69 : DeadLineCard ์žฌ์‚ฌ์šฉ ํ•  ์ˆ˜ ์žˆ๋„๋ก ๋ถ„๋ฆฌ
tgyuuAn Dec 28, 2023
7462c96
[FEATURE] #69 : ์„ค๋ฌธ์กฐ์‚ฌ ๋“ฑ๋ก UI ๋ณด์™„
tgyuuAn Dec 28, 2023
3dd2a56
[FEATURE] #69 : ์ผ์ • ๋“ฑ๋ก ๋กœ์ง ๋Œ€๊ณต์‚ฌ
tgyuuAn Dec 28, 2023
e556a44
[FEATURE] #69 : ์ผ์ • ์ถ”๊ฐ€ Dialog ์ ์šฉ ๋ฐ UI ๊ฐœ์„ 
tgyuuAn Dec 28, 2023
55682ba
[REFACTOR] #69 : eventId Int -> String ์œผ๋กœ ๋ณ€๊ฒฝ
tgyuuAn Dec 28, 2023
5dc38dc
[REFACTOR] #69 : RegistrationTextField ์ƒ๋‹จ ๋ถ€ํ„ฐ ์ž…๋ ฅ ๋ฐ›๋„๋ก ์ˆ˜์ •
tgyuuAn Dec 28, 2023
a0d381b
[REFACTOR] #69 : ์ผ์ • ๋“ฑ๋ก ๋กœ์ง ๋ณ€๊ฒฝ
tgyuuAn Dec 29, 2023
533d391
[FEATURE] #69 : ๋“ฑ๋ก SharedFlow ์ถ”๊ฐ€
tgyuuAn Dec 29, 2023
4b666eb
[FEATURE] #69 : ์ผ์ • ๋“ฑ๋ก Validation ์ถ”๊ฐ€
tgyuuAn Dec 29, 2023
2cae0bf
[FEATURE] #69 : ๋งˆ๊ฐ ์„ค์ •์„ ์œ„ํ•ด StateFlow ์ถ”๊ฐ€
tgyuuAn Jan 1, 2024
22f257b
[FEATURE] #69 : ์‹œ์ž‘ ์‹œ๊ฐ„, ์‹œ์ž‘ ๋‚ ์งœ ํŒŒ๋ผ๋ฏธํ„ฐ ๋ฐ string ์ถ”๊ฐ€
tgyuuAn Jan 1, 2024
288da2a
[FEATURE] #69 : ์‹œ์ž‘ ์‹œ๊ฐ„, ์‹œ์ž‘ ๋‚ ์งœ ์„ ํƒ ๊ธฐ๋Šฅ ์ถ”๊ฐ€
tgyuuAn Jan 1, 2024
d45b4ce
[FEATURE] #69 : ์‹œ์ž‘, ์ข…๋ฃŒ ๋‹ค์ด์–ผ๋กœ๊ทธ ๊ตฌ๋ถ„
tgyuuAn Jan 1, 2024
92241e1
[FEATURE] #69 : DB Entity ์‹œ์ž‘ ๋‚ ์งœ ๋ฐ˜์˜
tgyuuAn Jan 1, 2024
ce1e79c
[FEATURE] #69 : EventResponse๋„ StartDateTime, EndDateTime์œผ๋กœ ๋ณ€๊ฒฝ
tgyuuAn Jan 2, 2024
ba26ef5
[FEATURE] #69 : ์ผ์ • ๋ฐ์ดํ„ฐ ๋””์ž์ธ์— ๋งž๊ฒŒ ํ™”๋ฉด์— ๋ณด์—ฌ์ฃผ๋„๋ก ๋ณ€๊ฒฝ
tgyuuAn Jan 2, 2024
6af73f3
[REFACTOR] #69 : ๋„ˆ๋ฌด ๊ธด ๊ตฌ๋ฌธ ๋ณ€์ˆ˜๋กœ ๋นผ์„œ ๊ตฌ๋ถ„ํ•˜๊ธฐ ์‰ฝ๋„๋ก ๋ณ€๊ฒฝ
tgyuuAn Jan 2, 2024
5163eaa
[REFACTOR] #69 : ๋‹ฌ๋ ฅ ๋ถ€๋ถ„ ์•ฝ๊ฐ„์˜ ์ฃผ์„ ์ถ”๊ฐ€
tgyuuAn Jan 2, 2024
f285487
[REFACTOR] #69 : DateTimeFormatter ๋ฏธ๋ฆฌ Util์— ๋งŒ๋“ค์–ด์ง„ Formatter ํ™œ์šฉ
tgyuuAn Jan 2, 2024
a11d247
[REFACTOR] #69 : ๋ถˆํ•„์š”ํ•œ Result fold ์ œ๊ฑฐ
tgyuuAn Jan 2, 2024
7e6b4bc
[REFACTOR] #69 : ๋ถˆํ•„์š”ํ•œ ๊ฐœํ–‰ ์ œ๊ฑฐ
tgyuuAn Jan 2, 2024
3f87779
[REFACTOR] #69 : Kotlin ๋‹จ์ผ ํ‘œํ˜„์‹ ์ฝ”ํ‹€๋ฆฐ ์ปจ๋ฒค์…˜ ์ ์šฉ ์•ˆ๋œ ๋ถ€๋ถ„ ์ ์šฉ
tgyuuAn Jan 2, 2024
fc17542
[REFACTOR] #69 : LocalDateTime -> String Uitl๋กœ ๋ถ„๋ฆฌ
tgyuuAn Jan 2, 2024
f027b29
[REFACTOR] #69 : DayOfWeek -> CalendarWeekDays
tgyuuAn Jan 2, 2024
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
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
package com.wap.wapp.core.commmon.util

import java.time.LocalDate
import java.time.LocalDateTime
import java.time.LocalTime
import java.time.ZoneId
import java.time.format.DateTimeFormatter

object DateUtil {

fun generateNowTime(zoneId: ZoneId = ZoneId.of("Asia/Seoul")): LocalTime = LocalTime.now(zoneId)

fun generateNowDate(zoneId: ZoneId = ZoneId.of("Asia/Seoul")): LocalDate = LocalDate.now(zoneId)

fun generateNowDateTime(zoneId: ZoneId = ZoneId.of("Asia/Seoul")): LocalDateTime =
LocalDateTime.now(zoneId)

const val YEAR_MONTH_START_INDEX = 0
const val YEAR_MONTH_END_INDEX = 7
const val MONTH_DATE_START_INDEX = 5
const val DAYS_IN_WEEK = 7

// ํ˜„์žฌ ๋‚ ์งœ์—์„œ ์‹œ๊ฐ„, ๋ถ„๋งŒ ๋ฐ˜ํ™˜ํ•ด์ฃผ๋Š” ํฌ๋งท ex 19:00
val HHmmFormatter = DateTimeFormatter.ofPattern("HH:mm")

// ํ˜„์žฌ ๋‚ ์งœ์—์„œ ์ผ๋งŒ ๋ฐ˜ํ™˜ํ•ด์ฃผ๋Š” ํฌ๋งท ex 2023-11-20 -> 20
val ddFormatter = DateTimeFormatter.ofPattern("dd")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ package com.wap.wapp.core.data.repository.event

import com.wap.wapp.core.model.event.Event
import java.time.LocalDate
import java.time.LocalDateTime

interface EventRepository {
suspend fun getMonthEvents(date: LocalDate): Result<List<Event>>

suspend fun postEvent(
date: LocalDate,
eventTitle: String,
eventContent: String,
eventLocation: String,
eventDate: String,
eventTime: String,
eventStartDateTime: LocalDateTime,
eventEndDateTime: LocalDateTime,
): Result<Unit>
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package com.wap.wapp.core.data.repository.event

import com.wap.wapp.core.model.event.Event
import com.wap.wapp.core.network.model.event.EventRequest
import com.wap.wapp.core.network.source.event.EventDataSource
import java.time.LocalDate
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
import javax.inject.Inject

class EventRepositoryImpl @Inject constructor(
Expand All @@ -17,21 +18,17 @@ class EventRepositoryImpl @Inject constructor(
}

override suspend fun postEvent(
date: LocalDate,
eventTitle: String,
eventContent: String,
eventLocation: String,
eventDate: String,
eventTime: String,
eventStartDateTime: LocalDateTime,
eventEndDateTime: LocalDateTime,
): Result<Unit> =
eventDataSource.postEvent(
date = date,
EventRequest(
title = eventTitle,
content = eventContent,
location = eventLocation,
period = eventDate,
time = eventTime,
),
title = eventTitle,
content = eventContent,
location = eventLocation,
startDateTime = eventStartDateTime.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ํ•ด๋‹น ๋กœ์ง์œผ๋กœ, data ๋ชจ๋“ˆ์—์„œ๋„ 3๋ฒˆ ํฌ๋งทํŒ… ์‚ฌ์šฉ๋˜์–ด์„œ

network์ฒ˜๋Ÿผ ์œ ํ‹ธ๋กœ ๋นผ๋ฒ„๋ฆฌ๋Š”๊ฒŒ ์–ด๋–จ๊นŒ์š” ?

Copy link
Member Author

@tgyuuAn tgyuuAn Jan 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DateUtil ๋กœ ๋นผ๋†“๊ฒ ์Šต๋‹ˆ๋‹ค!

endDateTime = eventEndDateTime.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME),
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ interface SurveyRepository {
suspend fun getSurvey(surveyId: String): Result<Survey>

suspend fun postSurvey(
eventId: Int,
eventId: String,
userId: String,
title: String,
content: String,
surveyAnswerList: List<SurveyAnswer>,
surveyedAt: LocalDateTime,
): Result<Unit>

suspend fun isSubmittedSurvey(eventId: Int, userId: String): Result<Boolean>
suspend fun isSubmittedSurvey(eventId: String, userId: String): Result<Boolean>
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class SurveyRepositoryImpl @Inject constructor(
}

override suspend fun postSurvey(
eventId: Int,
eventId: String,
userId: String,
title: String,
content: String,
Expand All @@ -62,7 +62,7 @@ class SurveyRepositoryImpl @Inject constructor(
)
}

override suspend fun isSubmittedSurvey(eventId: Int, userId: String): Result<Boolean> {
override suspend fun isSubmittedSurvey(eventId: String, userId: String): Result<Boolean> {
return surveyDataSource.isSubmittedSurvey(eventId, userId)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,28 @@ package com.wap.wapp.core.domain.usecase.event

import com.wap.wapp.core.data.repository.event.EventRepository
import java.time.LocalDate
import java.time.LocalDateTime
import java.time.LocalTime
import javax.inject.Inject

class PostEventUseCase @Inject constructor(
class RegisterEventUseCase @Inject constructor(
private val eventRepository: EventRepository,
) {
suspend operator fun invoke(
date: LocalDate,
eventTitle: String,
eventContent: String,
eventLocation: String,
eventDate: String,
eventTime: String,
eventStartDate: LocalDate,
eventStartTime: LocalTime,
eventEndDate: LocalDate,
eventEndTime: LocalTime,
): Result<Unit> = runCatching {
eventRepository.postEvent(
date = date,
eventTitle = eventTitle,
eventContent = eventContent,
eventLocation = eventLocation,
eventDate = eventDate,
eventTime = eventTime,
eventStartDateTime = LocalDateTime.of(eventStartDate, eventStartTime),
eventEndDateTime = LocalDateTime.of(eventEndDate, eventEndTime),
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class IsSubmittedSurveyUseCase @Inject constructor(
private val userRepository: UserRepository,
private val surveyRepository: SurveyRepository,
) {
suspend operator fun invoke(eventId: Int): Result<Boolean> {
suspend operator fun invoke(eventId: String): Result<Boolean> {
return runCatching {
val userId = userRepository.getUserId().getOrThrow()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class PostSurveyUseCase @Inject constructor(
private val surveyRepository: SurveyRepository,
) {
suspend operator fun invoke(
eventId: Int,
eventId: String,
title: String,
content: String,
surveyAnswerList: List<SurveyAnswer>,
Expand Down
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
Expand Up @@ -4,14 +4,14 @@ import java.time.LocalDateTime

// ์šด์˜์ง„์ด ๋“ฑ๋กํ•˜๋Š” ์„ค๋ฌธ ๋ชจ๋ธ
data class SurveyForm(
val eventId: Int,
val eventId: String,
val title: String,
val content: String,
val surveyQuestionList: List<SurveyQuestion>,
val deadline: LocalDateTime,
) {
constructor() : this(
-1,
"",
"",
"",
emptyList(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ data class EventRequest(
val title: String = "",
val content: String = "",
val location: String = "",
val period: String = "",
val time: String = "",
val eventId: Int = 0,
val startDateTime: String = "",
val endDateTime: String = "",
val eventId: String = "",
)
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package com.wap.wapp.core.network.model.event

import com.wap.wapp.core.model.event.Event
import java.time.LocalDate
import com.wap.wapp.core.network.utils.toISOLocalDateTime
import java.time.format.DateTimeFormatter

data class EventResponse(
val content: String = "",
val eventId: Int = 0,
val eventId: String = "",
val location: String = "",
val period: String = "",
val title: String = "",
val time: String = "",
val startDateTime: String = "",
val endDateTime: String = "",
) {
private val formatter = DateTimeFormatter.ofPattern("yyyy.MM.dd")

Expand All @@ -19,7 +19,7 @@ data class EventResponse(
eventId = eventId,
location = location,
title = title,
period = LocalDate.parse(this.period, formatter),
time = time,
startDateTime = startDateTime.toISOLocalDateTime(),
endDateTime = endDateTime.toISOLocalDateTime(),
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.wap.wapp.core.model.survey.SurveyAnswer

data class SurveyRequest(
val surveyId: String,
val eventId: Int,
val eventId: String,
val userId: String,
val title: String,
val content: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package com.wap.wapp.core.network.model.survey.form
import com.wap.wapp.core.model.survey.SurveyQuestion

data class SurveyFormRequest(
val eventId: Int,
val eventId: String,
val title: String,
val content: String,
val surveyQuestionList: List<SurveyQuestion>,
val deadline: String,
) {
constructor() : this(
-1,
"",
"",
"",
emptyList(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import com.wap.wapp.core.model.survey.SurveyForm
import com.wap.wapp.core.network.utils.toISOLocalDateTime

data class SurveyFormResponse(
val eventId: Int,
val eventId: String,
val userId: String,
val title: String,
val content: String,
val surveyQuestionList: List<SurveyQuestionResponse>,
val deadline: String,
) {
constructor() : this(
-1,
"",
"",
"",
"",
Expand Down
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
Expand Up @@ -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
Expand All @@ -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()))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ํ•ด๋‹น ์ฝ”๋“œ ๊ด„ํ˜ธ๋•Œ๋ฌธ์— ์•Œ์•„๋ณด๊ธฐ ์‰ฝ์ง€ ์•Š์€๋ฐ, startDateTime ~ toLocalDate ๊นŒ์ง€ ๋ณ€์ˆ˜๋กœ ๋นผ๋ฒ„๋ฆฌ๋Š” ๊ฑด ์–ด๋•Œ์š” ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์•„์ฃผ ์ข‹์€ ์ƒ๊ฐ์ž…๋‹ˆ๋‹ค ์ง„ํ˜ธ์ƒ. ์ˆ˜์ •ํ•ด๋†“์„๊ฒŒ์š”!

.collection(EVENT_COLLECTION)
.document()
.document(documentId)
.set(eventRequest)
.await()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ด์ „๋ถ€ํ„ฐ ๊ฐœํ–‰์„ ๊ณ„์† ํ•˜์‹œ๋˜๋ฐ,

๋”ฐ๋กœ ๊ฐœํ–‰ํ•˜์‹œ๋Š” ์ด์œ ๊ฐ€ ์žˆ์„๊นŒ์š”??

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jeongjaino

์ „ ๊ฐœํ–‰ ๋ฌด์กฐ๊ฑด ํ•ด์•ผํ•˜๋Š” ๊ฑด ์ค„ ์•Œ์•˜์–ด์š”........... ์ปจ๋ฒค์…˜ ์ฝ์–ด๋ณด๊ณ  ์˜ค๊ฒ ์Šต๋‹ˆ๋‹ค ใ…‹ใ…‹ใ…‹ใ…‹ใ…‹ใ…‹ํใ… 

Copy link
Member Author

@tgyuuAn tgyuuAn Jan 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

๊ผญ ์•ˆํ•ด๋„ ๋˜๊ณ , ์ค„๋ฐ”๊ฟˆ์ด ํ•„์š”ํ•œ ๊ฒฝ์šฐ์—๋งŒ ์ค„๋ฐ”๊ฟˆ์„ ํ•˜๋Š”๊ตฐ์š”................

๋‹ค์‹œ ์›๋ž˜๋Œ€๋กœ ์ˆ˜์ •ํ•ด๋†จ์Šต๋‹ˆ๋‹ค!

Copy link
Member

Choose a reason for hiding this comment

The 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,
Expand Down
Loading