Skip to content

Commit

Permalink
Merge pull request #55 from Fill-ENERGY/Feature/#4-community
Browse files Browse the repository at this point in the history
Feature/#4 community
  • Loading branch information
seohyeon121 authored Aug 17, 2024
2 parents b5fea83 + 0c03d1a commit a699a61
Show file tree
Hide file tree
Showing 30 changed files with 1,366 additions and 652 deletions.
49 changes: 0 additions & 49 deletions app/src/main/java/com/example/energy/data/CommunityPostDatabase.kt

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
package com.example.energy.data.repository.community

import com.example.energy.data.repository.map.ListResponse
import okhttp3.MultipartBody
import retrofit2.Call
import retrofit2.http.Body
import retrofit2.http.DELETE
import retrofit2.http.GET
import retrofit2.http.Header
import retrofit2.http.Multipart
import retrofit2.http.POST
import retrofit2.http.Part
import retrofit2.http.Path
import retrofit2.http.Query

interface CommunityInterface {

//전체 커뮤니티 조회 api
@GET("/api/v1/boards")
fun getListCommunity(
@Header("Authorization") accessToken: String,
@Query("category") category: String,
@Query("cursor") cursor: Int? = 0,
@Query("limit") limit: Int? = 10,
@Query("sort") sort: String? = "LATEST",
): Call<CommunityResponse>


//개별 상세 커뮤니티 조회 api
@GET("/api/v1/boards/{boardId}")
fun getDetailCommunity(
@Header("Authorization") accessToken: String,
@Path("boardId") boardId: Int,
): Call<DetailResponse>


//게시글 작성 api
@POST("/api/v1/boards")
fun postBoard(
@Header("Authorization") accessToken: String,
@Body request: PostBoardRequest,
): Call<UploadResponse>


// //게시글 삭제 api
// @DELETE("/api/v1/boards/{boardId}")
// fun deleteBoard(
// @Header("Authorization") accessToken: String,
// @Path("boardId") boardId: Int,
// )


//이미지 업로드 api
@Multipart
@POST("/api/v1/boards/images")
fun uploadImages(
@Header("Authorization") accessToken: String,
@Part("images") images: UploadImagesRequest
): Call<UploadImagesResponse>


//게시글 좋아요 추가 api
@POST("/api/v1/boards/{boardId}/likes")
fun postLikeBoard(
@Header("Authorization") accessToken: String,
@Path("boardId") boardId: Int,
): Call<LikeResponse>
//게시글 좋아요 삭제 api
@DELETE("/api/v1/boards/{boardId}/likes")
fun deleteLikeBoard(
@Header("Authorization") accessToken: String,
@Path("boardId") boardId: Int,
): Call<LikeResponse>

//커뮤니티 댓글 조회 api
@GET("/api/v1/boards/{boardId}/comments")
fun getListComment(
@Header("Authorization") accessToken: String,
@Path("boardId") boardId: Int,
): Call<CommentListResponse>

//댓글 작성 api
@POST("/api/v1/boards/{boardId}/comments")
fun writeCommentBoard(
@Header("Authorization") accessToken: String,
@Path("boardId") boardId: Int,
@Body request: WriteCommentRequest,
): Call<CommentResponse>
}

This file was deleted.

This file was deleted.

Loading

0 comments on commit a699a61

Please sign in to comment.