Skip to content

Commit

Permalink
Merge pull request #46 from gaeun5744/develop
Browse files Browse the repository at this point in the history
[FEAT] 회고 조회 뷰 api 구현
  • Loading branch information
gaeun5744 authored Jul 19, 2023
2 parents f91ce7d + cbe8523 commit 6fc6b53
Show file tree
Hide file tree
Showing 34 changed files with 542 additions and 274 deletions.
16 changes: 11 additions & 5 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,19 @@
android:windowSoftInputMode="adjustPan">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="oauth"
android:scheme="kakao${NATIVE_APP_KEY}" />
</intent-filter>
</activity>
<activity
android:name=".presentation.invitationCode.InvitationCodeActivity"
Expand All @@ -53,10 +63,6 @@
<activity android:name=".presentation.onboarding.LoginActivity"
android:exported="true">
<intent-filter>

<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />

<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,34 @@ import kotlinx.serialization.Serializable

@Serializable
data class ResponseDetailRetroDto(
@SerialName("reviewId")
val reviewId: Int?,
@SerialName("reviewDay")
val reviewDay: String,
@SerialName("reviewDate")
val reviewDate: String,
@SerialName("contents")
val contents: List<Content>?,
@SerialName("status")
val status: Int,
@SerialName("success")
val success: Boolean,
@SerialName("message")
val message: String,
@SerialName("data")
val data: List<DetailReviewData>?,
) {
@Serializable
data class Content(
@SerialName("title")
val title: String,
@SerialName("content")
val content: String,
)
data class DetailReviewData(
@SerialName("reviewId")
val reviewId: Int?,
@SerialName("reviewDay")
val reviewDay: String,
@SerialName("reviewDate")
val reviewDate: String,
@SerialName("reviewTemplateId")
val reviewTemplateId: Int,
@SerialName("contents")
val contents: List<Content>?,
) {
@Serializable
data class Content(
@SerialName("title")
val title: String,
@SerialName("content")
val content: String,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,23 @@ import kotlinx.serialization.Serializable

@Serializable
data class ResponseMyRetroListDto(
@SerialName("reviewId")
val reviewId: Int,
@SerialName("reviewDate")
val reviewDate: String,
@SerialName("contents")
val contents: String,
)
@SerialName("status")
val status: Int,
@SerialName("success")
val success: Boolean,
@SerialName("message")
val message: String,
@SerialName("data")
val data: List<ReviewData>?,
) {
@Serializable
data class ReviewData(
@SerialName("reviewId")
val reviewId: Int,
@SerialName("reviewDate")
val reviewDate: String,
@SerialName("contents")
val contents: String,
)
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.puzzling.puzzlingaos.data.repository

import com.puzzling.puzzlingaos.data.model.response.ResponseDetailRetroDto
import com.puzzling.puzzlingaos.data.model.response.ResponseMyRetroListDto
import com.puzzling.puzzlingaos.data.source.remote.MyPageDataSource
import com.puzzling.puzzlingaos.domain.repository.MyPageRepository
import javax.inject.Inject

class MyPageRepositoryImpl @Inject constructor(private val myPageDataSource: MyPageDataSource) :
MyPageRepository {
override suspend fun getMyProjectReview(memberId: Int, projectId: Int): ResponseMyRetroListDto {
return myPageDataSource.getMyProjectReview(memberId, projectId)
}

override suspend fun getMyDetailReview(
memberId: Int,
projectId: Int,
startDate: String,
endDate: String,
): ResponseDetailRetroDto {
return myPageDataSource.getMyDetailReview(memberId, projectId, startDate, endDate)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.puzzling.puzzlingaos.data.service

import com.puzzling.puzzlingaos.data.model.response.ResponseDetailRetroDto
import com.puzzling.puzzlingaos.data.model.response.ResponseMyRetroListDto
import retrofit2.http.GET
import retrofit2.http.Path
import retrofit2.http.Query

interface MyPageService {
@GET("api/v1/member/{memberId}/project/{projectId}/reviews")
suspend fun getMyProjectReview(
@Path("memberId") memberId: Int,
@Path("projectId") projectId: Int,
): ResponseMyRetroListDto

@GET("api/v1/member/{memberId}/project/{projectId}/review?")
suspend fun getMyDetailReview(
@Path("memberId") memberId: Int,
@Path("projectId") projectId: Int,
@Query("startDate") startDate: String,
@Query("endDate") endDate: String,
): ResponseDetailRetroDto
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.puzzling.puzzlingaos.data.source.remote

import com.puzzling.puzzlingaos.data.model.response.ResponseDetailRetroDto
import com.puzzling.puzzlingaos.data.model.response.ResponseMyRetroListDto

interface MyPageDataSource {
suspend fun getMyProjectReview(
memberId: Int,
projectId: Int,
): ResponseMyRetroListDto

suspend fun getMyDetailReview(
memberId: Int,
projectId: Int,
startDate: String,
endDate: String,
): ResponseDetailRetroDto
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.puzzling.puzzlingaos.data.source.remote.impl

import com.puzzling.puzzlingaos.data.model.response.ResponseDetailRetroDto
import com.puzzling.puzzlingaos.data.model.response.ResponseMyRetroListDto
import com.puzzling.puzzlingaos.data.service.MyPageService
import com.puzzling.puzzlingaos.data.source.remote.MyPageDataSource
import javax.inject.Inject

class MyPageDataSourceImpl @Inject constructor(private val apiService: MyPageService) :
MyPageDataSource {
override suspend fun getMyProjectReview(
memberId: Int,
projectId: Int,
): ResponseMyRetroListDto = apiService.getMyProjectReview(memberId, projectId)
override suspend fun getMyDetailReview(
memberId: Int,
projectId: Int,
startDate: String,
endDate: String,
): ResponseDetailRetroDto =
apiService.getMyDetailReview(memberId, projectId, startDate, endDate)
}
12 changes: 9 additions & 3 deletions app/src/main/java/com/puzzling/puzzlingaos/di/ApiModule.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package com.puzzling.puzzlingaos.di

import com.puzzling.puzzlingaos.data.service.MyPageService
import com.puzzling.puzzlingaos.data.service.PersonalReviewService
import com.puzzling.puzzlingaos.data.service.WriteReviewService
import com.puzzling.puzzlingaos.data.service.ProjectService
import com.puzzling.puzzlingaos.data.service.WriteReviewService
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
Expand All @@ -20,11 +21,16 @@ object ApiModule {

@Provides
@Singleton
fun provideWriteReviewService(@PuzzlingRetrofit retrofit: Retrofit): WriteReviewService =
retrofit.create(WriteReviewService::class.java)
fun provideMyPageService(@PuzzlingRetrofit retrofit: Retrofit): MyPageService =
retrofit.create(MyPageService::class.java)

@Provides
@Singleton
fun sendProjectRegister(@PuzzlingRetrofit retrofit: Retrofit): ProjectService =
retrofit.create(ProjectService::class.java)

@Provides
@Singleton
fun provideWriteReviewService(@PuzzlingRetrofit retrofit: Retrofit): WriteReviewService =
retrofit.create(WriteReviewService::class.java)
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import com.puzzling.puzzlingaos.data.source.remote.ProjectDataSource
import com.puzzling.puzzlingaos.data.source.remote.WriteReviewDataSource
import com.puzzling.puzzlingaos.data.source.remote.impl.MyDashBoardDataSourceImpl
import com.puzzling.puzzlingaos.data.source.remote.impl.ProjectDataSourceImpl
import com.puzzling.puzzlingaos.data.source.remote.MyPageDataSource
import com.puzzling.puzzlingaos.data.source.remote.impl.WriteReviewDataSourceImpl
import com.puzzling.puzzlingaos.data.source.remote.impl.MyPageDataSourceImpl

import dagger.Binds
import dagger.Module
import dagger.hilt.InstallIn
Expand All @@ -21,9 +24,13 @@ abstract class DataSourceModule {

@Singleton
@Binds
abstract fun providesWriteReviewDataSource(DataSourceImpl: WriteReviewDataSourceImpl): WriteReviewDataSource
abstract fun providesMyPageDataSource(DataSourceImpl: MyPageDataSourceImpl): MyPageDataSource

@Singleton
@Binds
abstract fun providesProjectRegisterDataSource(DataSourceImpl: ProjectDataSourceImpl): ProjectDataSource

@Singleton
@Binds
abstract fun sendProjectRegisterDataSource(DataSourceImpl: ProjectDataSourceImpl): ProjectDataSource
abstract fun providesWriteReviewDataSource(DataSourceImpl: WriteReviewDataSourceImpl): WriteReviewDataSource
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ package com.puzzling.puzzlingaos.di

import com.puzzling.puzzlingaos.data.repository.MyBoardRepositoryImpl
import com.puzzling.puzzlingaos.data.repository.ProjectRepositoryImpl
import com.puzzling.puzzlingaos.data.repository.WriteReviewRepositoryImpl
import com.puzzling.puzzlingaos.domain.repository.MyBoardRepository
import com.puzzling.puzzlingaos.domain.repository.MyPageRepository
import com.puzzling.puzzlingaos.domain.repository.ProjectRepository
import com.puzzling.puzzlingaos.data.repository.MyPageRepositoryImpl
import com.puzzling.puzzlingaos.data.repository.WriteReviewRepositoryImpl
import com.puzzling.puzzlingaos.domain.repository.WriteReviewRepository
import dagger.Binds
import dagger.Module
Expand All @@ -19,11 +21,14 @@ abstract class RepositoryModule {
@Binds
abstract fun providesMyBoardRepository(repoImpl: MyBoardRepositoryImpl): MyBoardRepository

@Binds
abstract fun providesMyPageRepository(repoImpl: MyPageRepositoryImpl): MyPageRepository

@Singleton
@Binds
abstract fun providesWriteReviewRepository(repoImpl: WriteReviewRepositoryImpl): WriteReviewRepository
abstract fun providesProjectRepository(repoImpl: ProjectRepositoryImpl): ProjectRepository

@Singleton
@Binds
abstract fun sendProjectRepository(repoImpl: ProjectRepositoryImpl): ProjectRepository
abstract fun providesWriteReviewRepository(repoImpl: WriteReviewRepositoryImpl): WriteReviewRepository
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.puzzling.puzzlingaos.domain.repository

import com.puzzling.puzzlingaos.data.model.response.ResponseDetailRetroDto
import com.puzzling.puzzlingaos.data.model.response.ResponseMyRetroListDto

interface MyPageRepository {

suspend fun getMyProjectReview(
memberId: Int,
projectId: Int,
): ResponseMyRetroListDto

suspend fun getMyDetailReview(
memberId: Int,
projectId: Int,
startDate: String,
endDate: String,
): ResponseDetailRetroDto
}
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
package com.puzzling.puzzlingaos.presentation.detailRetrospect

import android.content.Intent
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.MenuItem
import androidx.activity.viewModels
import androidx.constraintlayout.widget.ConstraintLayout
import com.google.android.material.tabs.TabLayoutMediator
import com.puzzling.puzzlingaos.R
import com.puzzling.puzzlingaos.base.BaseActivity
import com.puzzling.puzzlingaos.databinding.ActivityDetailRetroBinding
import com.puzzling.puzzlingaos.util.ViewModelFactory
import com.puzzling.puzzlingaos.presentation.main.MainActivity
import dagger.hilt.android.AndroidEntryPoint
import java.time.DayOfWeek
import java.time.LocalDate
import java.time.format.DateTimeFormatter

@AndroidEntryPoint
class DetailRetroActivity :
BaseActivity<ActivityDetailRetroBinding>(R.layout.activity_detail_retro) {

private val viewModel: DetailRetroViewModel by viewModels { ViewModelFactory(this) }
private val viewModel by viewModels<DetailRetroViewModel>()

private val tabTitle = getWeekDatesWithToday()

Expand All @@ -30,18 +34,23 @@ class DetailRetroActivity :

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
clickToolbarBtnBack()

viewModel.getDetailRetroList()
binding.tvDetailRetroTitle.text = intent.getStringExtra("Title")

viewModel.getDetailRetro()

viewModel.detailRetroList.observe(this) { contents ->

Log.d("오류", "contents : $contents")

for (day in contents) {
if (day.reviewId != null) {
num[viewModel.week.indexOf(day.reviewDay)] = BG_BLUE_100
} else {
num[viewModel.week.indexOf(day.reviewDay)] = BLACK_TEXT
if (contents != null) {
for (day in contents) {
if (day.reviewId != null) {
num[viewModel.week.indexOf(day.reviewDay)] = BG_BLUE_100
} else {
num[viewModel.week.indexOf(day.reviewDay)] = BLACK_TEXT
}
}
}
setItemBg()
Expand Down Expand Up @@ -98,4 +107,17 @@ class DetailRetroActivity :

return dates
}

private fun clickToolbarBtnBack() {
setSupportActionBar(binding.tbDetailRetroMain)
supportActionBar!!.setDisplayHomeAsUpEnabled(false)
supportActionBar?.setDisplayShowTitleEnabled(false)

binding.ibDetailRetroClose.setOnClickListener {
val intent = Intent(this, MainActivity::class.java)
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK)
startActivity(intent)
finish()
}
}
}
Loading

0 comments on commit 6fc6b53

Please sign in to comment.