-
Notifications
You must be signed in to change notification settings - Fork 2
(협업) API 재설계
Choi Woo Seok edited this page Oct 19, 2023
·
1 revision
- API가 너무 화면에 의존적이기 때문에(화면에 필요한 정보만 줌) 만약 기능이 조금 바뀌거나, 화면이 바뀌게 되면, 안드로이드 쪽 코드와 백엔드 쪽 코드가 모두 바뀌게 되는 문제점이 있었다. 이로 인해, 이전 안드 버전을 쓰는 사용자는 앱을 강제 업데이트 해야만 사용할 수 있었다.
- API를 화면에 의존적이지 않고, 도메인을 받도록 변경한다.
Response
[{
"activityType" : "동아리",
"id" : 4,
"name" : "인프콘"
},
"activityType" : "동아리",
"id" : 4,
"name" : "인프콘"
},
{
"activityType" : "동아리",
"id" : 4,
"name" : "인프콘"
}]
Request
{
"activityIds" : [ 4, 5, 6 ]
}
Response
[{
"activityType" : "동아리",
"id" : 4,
"name" : "인프콘"
},
"activityType" : "동아리",
"id" : 4,
"name" : "인프콘"
},
{
"activityType" : "동아리",
"id" : 4,
"name" : "인프콘"
}
링크 와
[POST
: 새로운 Activity 추가]
링크 가 같은 API인데 이름만 다릅니다!
Request
{
"activityIds" : [ 4, 5, 6 ]
}
Response
[{
"activityType" : "동아리",
"id" : 4,
"name" : "인프콘"
},
"activityType" : "동아리",
"id" : 4,
"name" : "인프콘"
},
{
"activityType" : "동아리",
"id" : 4,
"name" : "인프콘"
}
링크**
Response
[{
"activityType" : "동아리",
"id" : 4,
"name" : "인프콘"
},
"activityType" : "동아리",
"id" : 4,
"name" : "인프콘"
},
{
"activityType" : "동아리",
"id" : 4,
"name" : "인프콘"
}
[PUT
: 사용자의 Open Profile URL 업데이트](https://kerdy.kro.kr/docs/index.html#_put_%EC%82%AC%EC%9A%A9%EC%9E%90%EC%9D%98_open_profile_url_%EC%97%85%EB%8D%B0%EC%9D%B4%ED%8A%B8)
- 더 이상 사용되지 않는 API입니다.
[GET
: 특정 사용자의 프로필 정보 조회](https://kerdy.kro.kr/docs/index.html#_get_%ED%8A%B9%EC%A0%95_%EC%82%AC%EC%9A%A9%EC%9E%90%EC%9D%98_%ED%94%84%EB%A1%9C%ED%95%84_%EC%A0%95%EB%B3%B4_%EC%A1%B0%ED%9A%8C)
Respsone
{
"id" : 1,
"name" : "김길동",
"description" : "안녕하세요, 김길동입니다.",
"imageUrl" : "https://image",
"githubUrl" : "https://github.com/amaran-th"
"activities": [
{
"activityType" : "동아리",
"id" : 4,
"name" : "인프콘"
},
"activityType" : "동아리",
"id" : 4,
"name" : "인프콘"
},
{
"activityType" : "동아리",
"id" : 4,
"name" : "인프콘"
}
}
Response
[ {
"postId" : 1,
"content" : "함께해요~",
"updatedAt" : "2023-07-15"
"member" : {
"id" : 1,
"name" : "김길동",
"description" : "안녕하세요, 김길동입니다.",
"imageUrl" : "https://image",
"githubUrl" : "https://github.com/amaran-th"
"activities": [
{
"activityType" : "동아리",
"id" : 4,
"name" : "인프콘"
},
"activityType" : "동아리",
"id" : 4,
"name" : "인프콘"
},
{
"activityType" : "동아리",
"id" : 4,
"name" : "인프콘"
}
},
"event" : {
"id" : 1,
"name" : "인프콘 2023",
"informationUrl" : "http://infcon.com",
"startDate" : "2023:08:15:12:00:00",
"endDate" : "2023:08:15:12:00:00",
"applyStartDate" : "2023:08:01:12:00:00",
"applyEndDate" : "2023:08:15:12:00:00",
"location" : "코엑스",
"tags" : [ "코틀린", "백엔드", "안드로이드" ],
"thumbnailUrl" : "https://www.image.com",
"type" : "COMPETITION",
"imageUrls" : [ "imageUrl1", "imageUrl2" ],
"organization" : "인프런",
"paymentType" : "유료",
"eventMode" : "온라인"
}
},
...
]
• [GET
: 행사 목록 조회](https://kerdy.kro.kr/docs/index.html#_get_%ED%96%89%EC%82%AC_%EB%AA%A9%EB%A1%9D_%EC%A1%B0%ED%9A%8C)
[{
"id" : 1, o
"name" : "인프콘 2023", o
"informationUrl" : "http://infcon.com", o
"startDate" : "2023:08:15:12:00:00", o
"endDate" : "2023:08:15:12:00:00", o
"applyStartDate" : "2023:08:01:12:00:00", o
"applyEndDate" : "2023:08:15:12:00:00", o
"location" : "코엑스", o
"tags" : [ "코틀린", "백엔드", "안드로이드" ], o
"thumbnailUrl" : "https://www.image.com", o
"type" : "COMPETITION", o
"imageUrls" : [ "imageUrl1", "imageUrl2" ],
"organization" : "인프런",
"paymentType" : "유료", o
"eventMode" : "온라인" o
},
{
"id" : 1, o
"name" : "인프콘 2023", o
"informationUrl" : "http://infcon.com", o
"startDate" : "2023:08:15:12:00:00", o
"endDate" : "2023:08:15:12:00:00", o
"applyStartDate" : "2023:08:01:12:00:00", o
"applyEndDate" : "2023:08:15:12:00:00", o
"location" : "코엑스", o
"tags" : [ "코틀린", "백엔드", "안드로이드" ], o
"thumbnailUrl" : "https://www.image.com", o
"type" : "COMPETITION", o
"imageUrls" : [ "imageUrl1", "imageUrl2" ],
"organization" : "인프런",
"paymentType" : "유료", o
"eventMode" : "온라인" o
},
...
]
• [GET
: 함께 해요 게시글 목록 조회](https://kerdy.kro.kr/docs/index.html#_get_%ED%95%A8%EA%BB%98_%ED%95%B4%EC%9A%94_%EA%B2%8C%EC%8B%9C%EA%B8%80_%EB%AA%A9%EB%A1%9D_%EC%A1%B0%ED%9A%8C)
Response
[ {
"postId" : 1,
"content" : "함께해요~",
"updatedAt" : "2023-07-15"
"member" : {
"id" : 1,
"name" : "김길동",
"description" : "안녕하세요, 김길동입니다.",
"imageUrl" : "https://image",
"githubUrl" : "https://github.com/amaran-th"
"activities": [
{
"activityType" : "동아리",
"id" : 4,
"name" : "인프콘"
},
"activityType" : "동아리",
"id" : 4,
"name" : "인프콘"
},
{
"activityType" : "동아리",
"id" : 4,
"name" : "인프콘"
}
},
"eventId" : 1L,
},
...
]
class Member(
Long id: Long,
String name,
String description,
String profileImageUrl,
String githubUrl,
List<Activity> activities,
)
• [GET
: 함께 해요 게시글 단건 조회](https://kerdy.kro.kr/docs/index.html#_get_%ED%95%A8%EA%BB%98_%ED%95%B4%EC%9A%94_%EA%B2%8C%EC%8B%9C%EA%B8%80_%EB%8B%A8%EA%B1%B4_%EC%A1%B0%ED%9A%8C)
• [GET
: 댓글 모두 조회](https://kerdy.kro.kr/docs/index.html#_get_%EB%8C%93%EA%B8%80_%EB%AA%A8%EB%91%90_%EC%A1%B0%ED%9A%8C)
// 복잡해서 클래스로 표현했습니다..ㅠㅠ
Response -> List<Comment>
class Comment(
Long id: Long,
String content,
Member author, // Member는 특정 Member 조회할 때 얻는 Member와 동일합니다!
LocalDateTime createdAt,
LocalDateTime updatedAt,
Comment parentComment?,
List<Comment> childComments,
Long feedId,
Boolean deleted,
)
• [GET
: 특정 댓글 조회(대댓글 있을 경우 같이 조회)](https://kerdy.kro.kr/docs/index.html#_get_%ED%8A%B9%EC%A0%95_%EB%8C%93%EA%B8%80_%EC%A1%B0%ED%9A%8C%EB%8C%80%EB%8C%93%EA%B8%80_%EC%9E%88%EC%9D%84_%EA%B2%BD%EC%9A%B0_%EA%B0%99%EC%9D%B4_%EC%A1%B0%ED%9A%8C)
Response : Comment
class Comment(
Long id: Long,
String content,
Member author, // Member는 특정 Member 조회할 때 얻는 Member와 동일합니다!
LocalDateTime createdAt,
LocalDateTime updatedAt,
Comment parentComment?,
List<Comment> childComments,
Long feedId,
Boolean deleted,
)
Request
{
"content" : "내용",
"feedId" : 1,
"parentId" : null
}
Response
class Comment(
Long id: Long,
String content,
Member author, // Member는 특정 Member 조회할 때 얻는 Member와 동일합니다!
LocalDateTime createdAt,
LocalDateTime updatedAt,
Comment parentComment?,
List<Comment> childComments,
Long feedId,
Boolean deleted,
)
[링크[(https://kerdy.kro.kr/docs/index.html#patch%EB%8C%93%EA%B8%80_%EC%88%98%EC%A0%95)
Request
{
"content" : "변경된 내용"
}
Response
class Comment(
Long id: Long,
String content,
Member author, // Member는 특정 Member 조회할 때 얻는 Member와 동일합니다!
LocalDateTime createdAt,
LocalDateTime updatedAt,
Comment parentComment?,
List<Comment> childComments,
Long feedId,
Boolean deleted,
)
Response
[{
"id" : 1, o
"name" : "인프콘 2023", o
"informationUrl" : "http://infcon.com", o
"startDate" : "2023:08:15:12:00:00", o
"endDate" : "2023:08:15:12:00:00", o
"applyStartDate" : "2023:08:01:12:00:00", o
"applyEndDate" : "2023:08:15:12:00:00", o
"location" : "코엑스", o
"tags" : [ "코틀린", "백엔드", "안드로이드" ], o
"thumbnailUrl" : "https://www.image.com", o
"type" : "COMPETITION", o
"imageUrls" : [ "imageUrl1", "imageUrl2" ],
"organization" : "인프런",
"paymentType" : "유료", o
"eventMode" : "온라인" o
},
{
"id" : 1, o
"name" : "인프콘 2023", o
"informationUrl" : "http://infcon.com", o
"startDate" : "2023:08:15:12:00:00", o
"endDate" : "2023:08:15:12:00:00", o
"applyStartDate" : "2023:08:01:12:00:00", o
"applyEndDate" : "2023:08:15:12:00:00", o
"location" : "코엑스", o
"tags" : [ "코틀린", "백엔드", "안드로이드" ], o
"thumbnailUrl" : "https://www.image.com", o
"type" : "COMPETITION", o
"imageUrls" : [ "imageUrl1", "imageUrl2" ],
"organization" : "인프런",
"paymentType" : "유료", o
"eventMode" : "온라인" o
},
...
]
Response
[ {
"roomId" : "b067d0ed-9758-45c0-a3a1-2efea9ac6149",
"interlocutorId" : 1,
"interlocutorName" : "receiver1",
"interlocutorProfile" : "imageUrl1",
"recentlyMessage" : Message
},
{
...
},
]
class Message(
Long id,
String content,
Member sender,
LocalDateTime createdAt,
)
Response
[ {
"sender" : Member,
"content" : "내용1",
"createdAt" : "2023:10:11:08:32:25"
},
...
]
class Message(
Long id,
String content,
Member sender,
LocalDateTime createdAt,
)
Response
{
"feeds" : [ {
"id" : 34,
"eventId" : 1L,
"title" : "피드1 제목",
"content" : "피드 내용",
"writer" : Member,
"images" : [ "https://image1.url", "https://image2.url" ],
"comments" : List<Comment> ,
"createdAt" : "2023:07:13:11:43:11",
"updatedAt" : "2023:07:13:11:43:11"
}, {
"id" : 35,
"title" : "피드2 제목",
"content" : "피드 내용",
"writerId" : 43,
"images" : [ ],
"commentCount" : 3,
"createdAt" : "2023:07:22:23:54:49",
"updatedAt" : "2023:07:22:23:54:49"
} ]
}
class Feed(
Long id: Long,
String title: String,
String content: String,
Member writer: Member,
List<Comment> comments,
List<String> imageUrls,
LocalDateTime createdAt,
LocalDateTime updatedAt,
Long eventId,
)
class Comment(
Long id: Long,
String content,
Member author, // Member는 특정 Member 조회할 때 얻는 Member와 동일합니다!
LocalDateTime createdAt,
LocalDateTime updatedAt,
Comment parentComment?,
List<Comment> childComments,
Long feedId,
Boolean deleted,
)
data class Member(
val id: Long,
val title: String,
val content: String,
val writer: Member,
val comments: List<Comment2>,
val imageUrls: List<String>?,
val createdAt: LocalDateTime,
val updatedAt: LocalDateTime,
val event: Event,
)
[GET
: 자신이 작성한 피드 목록 조회](https://kerdy.kro.kr/docs/index.html#_get_%EC%9E%90%EC%8B%A0%EC%9D%B4_%EC%9E%91%EC%84%B1%ED%95%9C_%ED%94%BC%EB%93%9C_%EB%AA%A9%EB%A1%9D_%EC%A1%B0%ED%9A%8C)
Response
[{
Feed,
Feed,
...
}]
class Feed(
Long id: Long,
String title: String,
String content: String,
Member writer: Member,
List<Comment> comments,
List<String> imageUrls,
LocalDateTime createdAt,
LocalDateTime updatedAt,
Event event,
)
링크**
response : Feed
class Feed(
Long id: Long,
String title: String,
String content: String,
Member writer: Member,
List<Comment> comments,
List<String> imageUrls,
LocalDateTime createdAt,
LocalDateTime updatedAt,
Event event,
)