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

Feat/#52 project matching #55

Merged
merged 13 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Expand Up @@ -3,6 +3,7 @@ package com.zucchini.ssuplector.di
import android.content.Context
import android.content.Intent
import com.zucchini.ai_members.designer.AiDesignerActivity
import com.zucchini.ai_members.matching.AiMatchingBotActivity
import com.zucchini.ai_members.pm.AiPmActivity
import com.zucchini.auth.LoginActivity
import com.zucchini.common.NavigationProvider
Expand All @@ -12,28 +13,31 @@ import dagger.hilt.android.qualifiers.ApplicationContext
import javax.inject.Inject

class DefaultNavigationProvider
@Inject
constructor(
@ApplicationContext private val context: Context,
) : NavigationProvider {
override fun toDevInfo(): Intent {
TODO("Not yet implemented")
}
@Inject
constructor(
@ApplicationContext private val context: Context,
) : NavigationProvider {
override fun toDevInfo(): Intent {
TODO("Not yet implemented")
}

override fun toProjects(): Intent {
TODO("Not yet implemented")
}

override fun toProjects(): Intent {
TODO("Not yet implemented")
}
override fun toMyPage(): Intent {
TODO("Not yet implemented")
}

override fun toMyPage(): Intent {
TODO("Not yet implemented")
}
override fun toLogin(): Intent = Intent(context, LoginActivity::class.java)

override fun toLogin(): Intent = Intent(context, LoginActivity::class.java)
override fun toSubmitDev(): Intent = Intent(context, SubmitDevActivity::class.java)

override fun toMain(): Intent = Intent(context, MainActivity::class.java)
override fun toSubmitDev(): Intent = Intent(context, SubmitDevActivity::class.java)
override fun toMain(): Intent = Intent(context, MainActivity::class.java)

override fun toAiPmMember(): Intent = Intent(context, AiPmActivity::class.java)
override fun toAiPmMember(): Intent = Intent(context, AiPmActivity::class.java)

override fun toAiDesignerMembers(): Intent = Intent(context, AiDesignerActivity::class.java)
}
override fun toAiDesignerMembers(): Intent = Intent(context, AiDesignerActivity::class.java)

override fun toAiMatchingBot(): Intent = Intent(context, AiMatchingBotActivity::class.java)
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ interface NavigationProvider {

fun toAiPmMember(): Intent
fun toAiDesignerMembers(): Intent
fun toAiMatchingBot(): Intent
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.sample.network.reponse

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class DeveloperMatchingResponse(
@SerialName("id")
val id: Int?,
@SerialName("name")
val name: String?,
@SerialName("email")
val email: String?,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.sample.network.request

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class DeveloperMatchingRequest(
@SerialName("part")
val part: String?,
@SerialName("languageList")
val languageList: List<String>,
@SerialName("techStackList")
val techStackList: List<String>,
@SerialName("projectExperience")
val projectExperience: Boolean,
@SerialName("studentNumberMin")
val studentNumberMin: Int?,
@SerialName("studentNumberMax")
val studentNumberMax: Int?,
)
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package com.sample.network.service

import com.sample.network.model.BaseResponse
import com.sample.network.reponse.DeveloperMatchingResponse
import com.sample.network.reponse.LoginResponse
import com.sample.network.reponse.MeetingProgressResponse
import com.sample.network.reponse.RefreshResponse
import com.sample.network.request.DeveloperMatchingRequest
import com.sample.network.request.MeetingProgressRequest
import okhttp3.MultipartBody
import retrofit2.http.Body
Expand All @@ -19,7 +21,14 @@ interface AiService {

@GET("/api/assistant/pm/meeting")
suspend fun getMeetingProgress(
@Query("pmRequestDTO") setMeetingProgress: MeetingProgressRequest,
@Query("introduceMyself") introduceMyself : Boolean,
@Query("iceBreaking") iceBreaking : Boolean,
@Query("brainstorming") brainstorming : Boolean,
@Query("topicSelection") topicSelection : Boolean,
@Query("progressSharing") progressSharing : Boolean,
@Query("roleDivision") roleDivision : Boolean,
@Query("troubleShooting") troubleShooting : Boolean,
@Query("feedback") feedback : Boolean,
@Query("time") time : Int?,
@Query("numberOfParticipants") participants : Int?,
): BaseResponse<MeetingProgressResponse>
Expand All @@ -39,4 +48,15 @@ interface AiService {
suspend fun getProjectImageData(
@Query("imageInfo") imageTextRequest : String?,
): BaseResponse<String>

@GET("/api/developers/match")
suspend fun getDevelopersMatching(
@Query("part") part: String,
@Query("languageList") languageList: List<String>,
@Query("techStackList") techStackList: List<String>,
@Query("projectExperience") projectExperience: Boolean,
@Query("studentNumberMin") studentNumberMin: Int,
@Query("studentNumberMax") studentNumberMax: Int,
@Query("developerInfo") developerInfo: String?
): BaseResponse<List<DeveloperMatchingResponse>>
}
32 changes: 29 additions & 3 deletions data/src/main/java/com/zucchini/data/AiRepositoryImpl.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package com.zucchini.data

import com.sample.network.service.AiService
import com.zucchini.domain.model.ai.DeveloperMatchingInfo
import com.zucchini.domain.model.ai.MatchingResult
import com.zucchini.domain.model.ai.ProgressMeeting
import com.zucchini.domain.model.ai.ProgressMeetingInfo
import com.zucchini.domain.model.ai.SetProgressMeeting
import com.zucchini.domain.repository.AiRepository
import com.zucchini.mapper.toMatchingResult
import com.zucchini.mapper.toMeetingProgress
import com.zucchini.mapper.toMeetingProgressRequest
import okhttp3.MediaType.Companion.toMediaTypeOrNull
Expand All @@ -25,9 +28,16 @@ constructor(
runCatching {
authService
.getMeetingProgress(
progressMeetingInfo.toMeetingProgressRequest(),
setProgressMeeting?.meetingTime,
setProgressMeeting?.participants,
introduceMyself = progressMeetingInfo.introduceMyself,
iceBreaking = progressMeetingInfo.iceBreaking,
brainstorming = progressMeetingInfo.brainstorming,
topicSelection = progressMeetingInfo.topicSelection,
progressSharing = progressMeetingInfo.progressSharing,
roleDivision = progressMeetingInfo.roleDivision,
troubleShooting = progressMeetingInfo.troubleShooting,
feedback = progressMeetingInfo.feedback,
time = setProgressMeeting?.meetingTime,
participants = setProgressMeeting?.participants,
).data
.toMeetingProgress()
}
Expand All @@ -51,4 +61,20 @@ constructor(
runCatching {
authService.getProjectImageData(projectImageRequest).data
}

override suspend fun getDevelopersMatchingResult(
matchingInfo: DeveloperMatchingInfo,
developerInfo: String
): Result<List<MatchingResult>> =
runCatching {
authService.getDevelopersMatching(
part = matchingInfo.part ?: "",
languageList = matchingInfo.languageList,
techStackList = matchingInfo.techStackList,
projectExperience = matchingInfo.projectExperience,
studentNumberMin = matchingInfo.studentNumberMin ?: 11,
studentNumberMax = matchingInfo.studentNumberMax ?: 11,
developerInfo = developerInfo,
).data.toMatchingResult()
}
}
15 changes: 15 additions & 0 deletions data/src/main/java/com/zucchini/mapper/ProgressMeetingMapper.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
package com.zucchini.mapper

import com.sample.network.reponse.DeveloperMatchingResponse
import com.sample.network.reponse.MeetingProgressResponse
import com.sample.network.reponse.SearchDeveloperResultResponse
import com.sample.network.request.DeveloperMatchingRequest
import com.sample.network.request.MeetingProgressRequest
import com.zucchini.domain.model.FindDeveloperInfo
import com.zucchini.domain.model.ai.DeveloperMatchingInfo
import com.zucchini.domain.model.ai.MatchingResult
import com.zucchini.domain.model.ai.ProgressMeeting
import com.zucchini.domain.model.ai.ProgressMeetingInfo

Expand All @@ -28,3 +34,12 @@ internal fun ProgressMeetingInfo.toMeetingProgressRequest(): MeetingProgressRequ
troubleShooting = troubleShooting,
feedback = feedback ,
)

internal fun List<DeveloperMatchingResponse>.toMatchingResult(): List<MatchingResult> =
this.map { matchingResult ->
MatchingResult(
id = matchingResult.id ?: -1,
name = matchingResult.name ?: "",
email = matchingResult.email ?: "",
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.zucchini.domain.model.ai

data class DeveloperMatchingInfo(
val part: String?,
val languageList: List<String>,
val techStackList: List<String>,
val projectExperience: Boolean,
val studentNumberMin: Int?,
val studentNumberMax: Int?,
)

data class DeveloperInfo(
val developerAdditionalCondition: String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.zucchini.domain.model.ai

data class MatchingResult(
val id: Int,
val name: String,
val email: String,
)
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.zucchini.domain.repository

import com.zucchini.domain.model.ai.DeveloperInfo
import com.zucchini.domain.model.ai.DeveloperMatchingInfo
import com.zucchini.domain.model.ai.MatchingResult
import com.zucchini.domain.model.ai.ProgressMeeting
import com.zucchini.domain.model.ai.ProgressMeetingInfo
import com.zucchini.domain.model.ai.SetProgressMeeting
Expand All @@ -9,5 +12,5 @@ interface AiRepository {
suspend fun sendMeetingRecordFile(recordFile: String) : Result<String>
suspend fun getProjectBranding(projectInfoTextRequest: String?) : Result<String>
suspend fun getProjectImage(projectImageRequest: String?) : Result<String>

suspend fun getDevelopersMatchingResult(matchingInfo: DeveloperMatchingInfo, developerInfo: String): Result<List<MatchingResult>>
}
14 changes: 10 additions & 4 deletions feature/projects/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />

<application>
<activity
android:name="com.zucchini.ai_members.matching.AiMatchingBotActivity"
android:exported="false"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
android:windowSoftInputMode="adjustPan" />
<activity
android:name="com.zucchini.ai_members.designer.AiDesignerActivity"
android:exported="false"
Expand All @@ -20,8 +26,8 @@
android:name="com.zucchini.submit.project.SubmitProjectActivity"
android:exported="false"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
android:windowSoftInputMode="adjustPan" />
<activity
android:name="com.zucchini.submit.developer.SubmitDevActivity"
android:exported="false"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,22 @@ class AiMembersFragment : Fragment() {
binding.aiMembersPmButton.setOnClickListener {
startActivity(navigationProvider.toAiPmMember())
}
binding.tvAiPmDescription.setOnClickListener {
startActivity(navigationProvider.toAiPmMember())
}

binding.aiMembersDesignerButton.setOnClickListener {
startActivity(navigationProvider.toAiDesignerMembers())
}
binding.tvAiDesignerText.setOnClickListener {
startActivity(navigationProvider.toAiDesignerMembers())
}

binding.aiMembersMatchingButton.setOnClickListener {
startActivity(navigationProvider.toAiMatchingBot())
}
binding.tvAiMatchingText.setOnClickListener {
startActivity(navigationProvider.toAiMatchingBot())
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import com.zucchini.feature.projects.R
import com.zucchini.feature.projects.databinding.FragmentBrandingBinding
import com.zucchini.feature.projects.databinding.FragmentStartProgressMeetingBinding
import com.zucchini.uistate.UiState
import com.zucchini.view.hideKeyboard
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
Expand Down Expand Up @@ -42,6 +43,7 @@ class BrandingFragment : Fragment() {
val requestProjectInfo = binding.etBrandingDescription.text.toString()

binding.btnSubmit.setOnClickListener {
hideKeyboard()
viewModel.getProjectBranding(requestProjectInfo)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import coil.load
import com.zucchini.ai_members.designer.AiDesignerViewModel
import com.zucchini.feature.projects.databinding.FragmentImageDesignBinding
import com.zucchini.uistate.UiState
import com.zucchini.view.hideKeyboard
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
Expand Down Expand Up @@ -40,6 +41,7 @@ class ImageDesignFragment : Fragment() {
val requestProjectInfo = binding.etImageDescription.text.toString()

binding.btnSubmitImage.setOnClickListener {
hideKeyboard()
viewModel.getProjectImage(requestProjectInfo)
}
}
Expand Down
Loading
Loading