diff --git a/src/main/kotlin/com/bside/activity/entity/Activity.kt b/src/main/kotlin/com/bside/activity/entity/Activity.kt new file mode 100644 index 0000000..2f0a1fa --- /dev/null +++ b/src/main/kotlin/com/bside/activity/entity/Activity.kt @@ -0,0 +1,37 @@ +package com.bside.activity.entity + +import com.bside.common.type.ActivityStatus + +import org.bson.types.ObjectId +import org.springframework.data.annotation.Id +import org.springframework.data.mongodb.core.mapping.Document +import org.springframework.data.mongodb.core.mapping.Field + +import java.time.LocalDateTime + + +data class Location( + val lat: Double, + val lon: Double +) + +@Document +data class Activity( + @Id + @Field(name = "_id") + val id: ObjectId = ObjectId.get(), + val leaderId: ObjectId, + val crewId: ObjectId, + val memberIds: List = listOf(), + val name: String, + val description: String, + val capacity: Int, + val joinCount:Int = 1, + val mainImage: String, + val location: Location, + val status: ActivityStatus = ActivityStatus.READY, + val startAt: LocalDateTime, + val createdDate: LocalDateTime = LocalDateTime.now(), + val modifiedDate: LocalDateTime = LocalDateTime.now() +) + diff --git a/src/main/kotlin/com/bside/activity/reposittory/ActivityRepository.kt b/src/main/kotlin/com/bside/activity/reposittory/ActivityRepository.kt new file mode 100644 index 0000000..64f689a --- /dev/null +++ b/src/main/kotlin/com/bside/activity/reposittory/ActivityRepository.kt @@ -0,0 +1,8 @@ +package com.bside.activity.reposittory + +import com.bside.activity.entity.Activity + +import org.springframework.data.mongodb.repository.MongoRepository + +interface ActivityRepository: MongoRepository{ +} diff --git a/src/main/kotlin/com/bside/common/type/ActivityStatus.kt b/src/main/kotlin/com/bside/common/type/ActivityStatus.kt new file mode 100644 index 0000000..a3cbfa7 --- /dev/null +++ b/src/main/kotlin/com/bside/common/type/ActivityStatus.kt @@ -0,0 +1,5 @@ +package com.bside.common.type + +enum class ActivityStatus { + READY, RUNNING, FINISHED +} \ No newline at end of file diff --git a/src/main/kotlin/com/bside/config/SwaggerConfig.kt b/src/main/kotlin/com/bside/config/SwaggerConfig.kt index 83ce3c2..7597476 100644 --- a/src/main/kotlin/com/bside/config/SwaggerConfig.kt +++ b/src/main/kotlin/com/bside/config/SwaggerConfig.kt @@ -3,6 +3,7 @@ package com.bside.config import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration import org.springframework.context.annotation.Profile + import springfox.documentation.builders.ApiInfoBuilder import springfox.documentation.builders.PathSelectors import springfox.documentation.builders.RequestHandlerSelectors @@ -10,8 +11,9 @@ import springfox.documentation.service.* import springfox.documentation.spi.DocumentationType import springfox.documentation.spi.service.contexts.SecurityContext import springfox.documentation.spring.web.plugins.Docket -import java.util.* +import java.util.function.Predicate +import java.util.* @Profile("local || dev") @Configuration @@ -21,13 +23,15 @@ class SwaggerConfig { fun api(): Docket? { //Docket: Swagger 설정의 핵심이 되는 Bean return Docket(DocumentationType.OAS_30) - .securityContexts(listOf(securityContext())) - .securitySchemes(listOf(apiKey()) as List?) - .select() - .apis(RequestHandlerSelectors.basePackage("com.bside.controller")) // controller package 지정 - .paths(PathSelectors.any()) - .build() - .apiInfo(apiInfo()) //:Swagger UI 로 노출할 정보 + .securityContexts(listOf(securityContext())) + .securitySchemes(listOf(apiKey()) as List?) + .select() + .apis(RequestHandlerSelectors.any()) + .paths(PathSelectors.ant("/api/**") + .and(Predicate.not( + PathSelectors.regex("/api/error.*")))) + .build() + .apiInfo(apiInfo()) //:Swagger UI 로 노출할 정보 } // api 정보 등록 diff --git a/src/main/kotlin/com/bside/crew/entity/Crew.kt b/src/main/kotlin/com/bside/crew/entity/Crew.kt new file mode 100644 index 0000000..79b2978 --- /dev/null +++ b/src/main/kotlin/com/bside/crew/entity/Crew.kt @@ -0,0 +1,28 @@ +package com.bside.crew.entity + +import org.bson.types.ObjectId + +import org.springframework.data.annotation.Id +import org.springframework.data.mongodb.core.mapping.Document +import org.springframework.data.mongodb.core.mapping.Field + +import java.time.LocalDateTime + +// 가입 인삿말 필드 추가 필요. +@Document +data class Crew( + @Id + @Field(name = "_id") + val id: ObjectId = ObjectId.get(), + val leaderId: ObjectId, + val memberIds: List = listOf(), + val name: String, + val title: String, + val description: String, + val capacity: Int, + val joinCount:Int = 1, + val mainImage: String, + val location: Map>, + val createdDate: LocalDateTime = LocalDateTime.now(), + val modifiedDate: LocalDateTime = LocalDateTime.now() +) diff --git a/src/main/kotlin/com/bside/crew/reposittory/CrewRepository.kt b/src/main/kotlin/com/bside/crew/reposittory/CrewRepository.kt new file mode 100644 index 0000000..c23e1f0 --- /dev/null +++ b/src/main/kotlin/com/bside/crew/reposittory/CrewRepository.kt @@ -0,0 +1,8 @@ +package com.bside.crew.reposittory + +import com.bside.crew.entity.Crew + +import org.springframework.data.mongodb.repository.MongoRepository + +interface CrewRepository: MongoRepository{ +} diff --git a/src/main/kotlin/com/bside/feedImage/entity/FeedImage.kt b/src/main/kotlin/com/bside/feedImage/entity/FeedImage.kt new file mode 100644 index 0000000..eb227dc --- /dev/null +++ b/src/main/kotlin/com/bside/feedImage/entity/FeedImage.kt @@ -0,0 +1,16 @@ +package com.bside.feedImage.entity + +import org.bson.types.ObjectId +import org.springframework.data.annotation.Id +import org.springframework.data.mongodb.core.mapping.Document +import org.springframework.data.mongodb.core.mapping.Field + +@Document +data class FeedImage( + @Id + @Field("_id") + val id: ObjectId = ObjectId.get(), + val memberId: ObjectId, + val crewId: ObjectId, + val image: String +) diff --git a/src/main/kotlin/com/bside/feedImage/repository/FeedImageRepository.kt b/src/main/kotlin/com/bside/feedImage/repository/FeedImageRepository.kt new file mode 100644 index 0000000..f1b5ddb --- /dev/null +++ b/src/main/kotlin/com/bside/feedImage/repository/FeedImageRepository.kt @@ -0,0 +1,8 @@ +package com.bside.feedImage.repository + +import com.bside.feedImage.entity.FeedImage + +import org.springframework.data.mongodb.repository.MongoRepository + +interface FeedImageRepository: MongoRepository { +} \ No newline at end of file diff --git a/src/main/kotlin/com/bside/member/MemberController.kt b/src/main/kotlin/com/bside/member/MemberController.kt index 2f59630..860ce2c 100644 --- a/src/main/kotlin/com/bside/member/MemberController.kt +++ b/src/main/kotlin/com/bside/member/MemberController.kt @@ -24,15 +24,4 @@ class MemberController( fun getEmail(@RequestParam email: String): MemberResponseDto { return memberService.getMemberInfo(email) } - - // 슬랙 에러알람 확인을 위한 테스트 용도 입니다. 다음 개발시 삭제 예정입니다. - @GetMapping("/error") - fun makeError() { - try { - val v = 1 / 0 - } catch (e: Exception) { - logger.error("error occurred", e) - } - } - } \ No newline at end of file diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 6b59ea8..75fe66f 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -3,3 +3,5 @@ ############################### server: port: 8080 + servlet: + contextPath: /api \ No newline at end of file