-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sync backend changes: Migrate image upload from Firebase (#17)
Fixes #16
- Loading branch information
Showing
19 changed files
with
195 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
app/src/main/java/com/mnnit/moticlubs/data/network/api/AvatarApi.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.mnnit.moticlubs.data.network.api | ||
|
||
import com.mnnit.moticlubs.data.network.dto.ClubDto | ||
import com.mnnit.moticlubs.data.network.dto.ImageUrlDto | ||
import com.mnnit.moticlubs.data.network.dto.UserDto | ||
import com.mnnit.moticlubs.domain.util.Constants.AUTHORIZATION_HEADER | ||
import com.mnnit.moticlubs.domain.util.Constants.AVATAR_ROUTE | ||
import com.mnnit.moticlubs.domain.util.Constants.CLUB_ID_CLAIM | ||
import okhttp3.MultipartBody | ||
import retrofit2.Response | ||
import retrofit2.http.Header | ||
import retrofit2.http.Multipart | ||
import retrofit2.http.POST | ||
import retrofit2.http.Part | ||
import retrofit2.http.Query | ||
|
||
interface AvatarApi { | ||
|
||
@POST("$AVATAR_ROUTE/user") | ||
@Multipart | ||
suspend fun updateUserAvatar( | ||
@Header(AUTHORIZATION_HEADER) auth: String?, | ||
@Part file: MultipartBody.Part, | ||
): Response<UserDto?> | ||
|
||
@POST("$AVATAR_ROUTE/club") | ||
@Multipart | ||
suspend fun updateClubAvatar( | ||
@Header(AUTHORIZATION_HEADER) auth: String?, | ||
@Query(CLUB_ID_CLAIM) clubId: Long, | ||
@Part file: MultipartBody.Part, | ||
): Response<ClubDto?> | ||
|
||
@POST("$AVATAR_ROUTE/post") | ||
@Multipart | ||
suspend fun uploadPostImage( | ||
@Header(AUTHORIZATION_HEADER) auth: String?, | ||
@Query(CLUB_ID_CLAIM) clubId: Long, | ||
@Part file: MultipartBody.Part, | ||
): Response<ImageUrlDto?> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
app/src/main/java/com/mnnit/moticlubs/data/network/dto/ImageUrlDto.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.mnnit.moticlubs.data.network.dto | ||
|
||
import com.google.gson.annotations.Expose | ||
import com.google.gson.annotations.SerializedName | ||
|
||
data class ImageUrlDto( | ||
@SerializedName("url") | ||
@Expose | ||
var url: String, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.