Commit 13516436 authored by Ghitha Dinan's avatar Ghitha Dinan

add swagger

parent 790e31b3
......@@ -3,6 +3,7 @@ package id.co.sangkuriang.inovasi.daerah.master.controller
import id.co.sangkuriang.inovasi.daerah.master.model.request.ApplicationCategoryRequest
import id.co.sangkuriang.inovasi.daerah.master.model.request.DeleteDataRequest
import id.co.sangkuriang.inovasi.daerah.master.model.request.PaginationRequest
import id.co.sangkuriang.inovasi.daerah.master.model.response.ReturnData
import id.co.sangkuriang.inovasi.daerah.master.service.ApplicationCategoryService
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.http.ResponseEntity
......@@ -18,12 +19,12 @@ class ApplicationCategoryController {
private lateinit var service: ApplicationCategoryService
@GetMapping(value = [""], produces = ["application/json"])
fun getAll(page: PaginationRequest): ResponseEntity<*>? {
fun getAll(page: PaginationRequest): ResponseEntity<ReturnData> {
return service.getAll(page)
}
@GetMapping(value = ["{id}"], produces = ["application/json"])
fun getDetail(@PathVariable id: String): ResponseEntity<*>? {
fun getDetail(@PathVariable id: String): ResponseEntity<ReturnData> {
return service.getDetail(id)
}
......@@ -31,7 +32,7 @@ class ApplicationCategoryController {
fun saveData(
@Valid @ModelAttribute request: ApplicationCategoryRequest,
httpServletRequest: HttpServletRequest
): ResponseEntity<*>? {
): ResponseEntity<ReturnData> {
return service.saveData(request, httpServletRequest)
}
......@@ -40,12 +41,12 @@ class ApplicationCategoryController {
@PathVariable id: String,
@Valid @ModelAttribute request: ApplicationCategoryRequest,
httpServletRequest: HttpServletRequest
): ResponseEntity<*>? {
): ResponseEntity<ReturnData> {
return service.updateData(id, request, httpServletRequest)
}
@DeleteMapping(value = [""], produces = ["application/json"])
fun deleteData(@Valid @RequestBody request: DeleteDataRequest, httpServletRequest: HttpServletRequest): ResponseEntity<*>? {
fun deleteData(@Valid @RequestBody request: DeleteDataRequest, httpServletRequest: HttpServletRequest): ResponseEntity<ReturnData> {
return service.deleteData(request, httpServletRequest)
}
}
......@@ -3,6 +3,7 @@ package id.co.sangkuriang.inovasi.daerah.master.controller
import id.co.sangkuriang.inovasi.daerah.master.model.request.DeleteDataRequest
import id.co.sangkuriang.inovasi.daerah.master.model.request.Pagination2Request
import id.co.sangkuriang.inovasi.daerah.master.model.request.PaginationRequest
import id.co.sangkuriang.inovasi.daerah.master.model.response.ReturnData
import id.co.sangkuriang.inovasi.daerah.master.pojo.Province
import id.co.sangkuriang.inovasi.daerah.master.service.ProvinceService
import org.springframework.beans.factory.annotation.Autowired
......@@ -19,32 +20,32 @@ class ProvinceController {
private lateinit var service: ProvinceService
@GetMapping(value = [""], produces = ["application/json"])
fun getAll(page: PaginationRequest): ResponseEntity<*>? {
fun getAll(page: PaginationRequest): ResponseEntity<ReturnData> {
return service.getAll(page)
}
@PostMapping(value = ["datatable"], produces = ["application/json"])
fun datatable(@RequestBody req: Pagination2Request): ResponseEntity<*>? {
fun datatable(@RequestBody req: Pagination2Request): ResponseEntity<ReturnData> {
return service.datatable(req)
}
@GetMapping(value = ["{id}"], produces = ["application/json"])
fun getDetail(@PathVariable id: String): ResponseEntity<*>? {
fun getDetail(@PathVariable id: String): ResponseEntity<ReturnData> {
return service.getDetail(id)
}
@PostMapping(value = [""], produces = ["application/json"])
fun saveData(@Valid @RequestBody request: Province): ResponseEntity<*>? {
fun saveData(@Valid @RequestBody request: Province): ResponseEntity<ReturnData> {
return service.saveData(request)
}
@PutMapping(value = ["{id}"], produces = ["application/json"])
fun updateData(@PathVariable id: String, @Valid @RequestBody request: Province): ResponseEntity<*>? {
fun updateData(@PathVariable id: String, @Valid @RequestBody request: Province): ResponseEntity<ReturnData> {
return service.updateData(id, request)
}
@DeleteMapping(value = [""], produces = ["application/json"])
fun deleteData(@Valid @RequestBody request: DeleteDataRequest, httpServletRequest: HttpServletRequest): ResponseEntity<*>? {
fun deleteData(@Valid @RequestBody request: DeleteDataRequest, httpServletRequest: HttpServletRequest): ResponseEntity<ReturnData> {
return service.deleteData(request, httpServletRequest)
}
}
package id.co.sangkuriang.inovasi.daerah.master.controller
import id.co.sangkuriang.inovasi.daerah.master.model.request.PaginationRequest
import id.co.sangkuriang.inovasi.daerah.master.model.response.ReturnData
import id.co.sangkuriang.inovasi.daerah.master.service.ApplicationCategoryService
import id.co.sangkuriang.inovasi.daerah.master.service.ProvinceService
import id.co.sangkuriang.inovasi.daerah.master.service.RegencyService
......@@ -29,37 +30,37 @@ class PublicController {
private lateinit var regencyService: RegencyService
@GetMapping(value = ["application-category/all"], produces = ["application/json"])
fun applicationCategoryAll(page: PaginationRequest): ResponseEntity<*>? {
fun applicationCategoryAll(page: PaginationRequest): ResponseEntity<ReturnData> {
return applicationCategoryService.getAll(page)
}
@GetMapping(value = ["tag/all"], produces = ["application/json"])
fun tagAll(page: PaginationRequest): ResponseEntity<*>? {
fun tagAll(page: PaginationRequest): ResponseEntity<ReturnData> {
return tagService.getAll(page)
}
@GetMapping(value = ["province/all"], produces = ["application/json"])
fun provinceAll(page: PaginationRequest): ResponseEntity<*>? {
fun provinceAll(page: PaginationRequest): ResponseEntity<ReturnData> {
return provinceService.getAll(page)
}
@GetMapping(value = ["province/get-by-name"], produces = ["application/json"])
fun provinceGetByName(@RequestParam("name") name: String): ResponseEntity<*>? {
fun provinceGetByName(@RequestParam("name") name: String): ResponseEntity<ReturnData> {
return provinceService.getByName(name)
}
@GetMapping(value = ["regency/all"], produces = ["application/json"])
fun regencyAll(page: PaginationRequest): ResponseEntity<*>? {
fun regencyAll(page: PaginationRequest): ResponseEntity<ReturnData> {
return regencyService.getAll(page)
}
@GetMapping(value = ["application-category/count"], produces = ["application/json"])
fun applicationCategoryCount(): ResponseEntity<*>? {
fun applicationCategoryCount(): ResponseEntity<ReturnData> {
return applicationCategoryService.count()
}
@GetMapping(value = ["province/count"], produces = ["application/json"])
fun provinceCount(): ResponseEntity<*>? {
fun provinceCount(): ResponseEntity<ReturnData> {
return provinceService.count()
}
......
......@@ -2,6 +2,7 @@ package id.co.sangkuriang.inovasi.daerah.master.controller
import id.co.sangkuriang.inovasi.daerah.master.model.request.DeleteDataRequest
import id.co.sangkuriang.inovasi.daerah.master.model.request.PaginationRequest
import id.co.sangkuriang.inovasi.daerah.master.model.response.ReturnData
import id.co.sangkuriang.inovasi.daerah.master.pojo.Regency
import id.co.sangkuriang.inovasi.daerah.master.service.RegencyService
import org.springframework.beans.factory.annotation.Autowired
......@@ -18,27 +19,27 @@ class RegencyController {
private lateinit var service: RegencyService
@GetMapping(value = [""], produces = ["application/json"])
fun getAll(page: PaginationRequest): ResponseEntity<*>? {
fun getAll(page: PaginationRequest): ResponseEntity<ReturnData> {
return service.getAll(page)
}
@GetMapping(value = ["{id}"], produces = ["application/json"])
fun getDetail(@PathVariable id: String): ResponseEntity<*>? {
fun getDetail(@PathVariable id: String): ResponseEntity<ReturnData> {
return service.getDetail(id)
}
@PostMapping(value = [""], produces = ["application/json"])
fun saveData(@Valid @RequestBody request: Regency): ResponseEntity<*>? {
fun saveData(@Valid @RequestBody request: Regency): ResponseEntity<ReturnData> {
return service.saveData(request)
}
@PutMapping(value = ["{id}"], produces = ["application/json"])
fun updateData(@PathVariable id: String, @Valid @RequestBody request: Regency): ResponseEntity<*>? {
fun updateData(@PathVariable id: String, @Valid @RequestBody request: Regency): ResponseEntity<ReturnData> {
return service.updateData(id, request)
}
@DeleteMapping(value = [""], produces = ["application/json"])
fun deleteData(@Valid @RequestBody request: DeleteDataRequest, httpServletRequest: HttpServletRequest): ResponseEntity<*>? {
fun deleteData(@Valid @RequestBody request: DeleteDataRequest, httpServletRequest: HttpServletRequest): ResponseEntity<ReturnData> {
return service.deleteData(request, httpServletRequest)
}
}
......@@ -2,6 +2,7 @@ package id.co.sangkuriang.inovasi.daerah.master.controller
import id.co.sangkuriang.inovasi.daerah.master.model.request.DeleteDataRequest
import id.co.sangkuriang.inovasi.daerah.master.model.request.PaginationRequest
import id.co.sangkuriang.inovasi.daerah.master.model.response.ReturnData
import id.co.sangkuriang.inovasi.daerah.master.pojo.Tag
import id.co.sangkuriang.inovasi.daerah.master.service.TagService
import org.springframework.beans.factory.annotation.Autowired
......@@ -18,22 +19,22 @@ class TagController {
private lateinit var service: TagService
@GetMapping(value = [""], produces = ["application/json"])
fun getAll(page: PaginationRequest): ResponseEntity<*>? {
fun getAll(page: PaginationRequest): ResponseEntity<ReturnData>? {
return service.getAll(page)
}
@GetMapping(value = ["{id}"], produces = ["application/json"])
fun getDetail(@PathVariable id: String): ResponseEntity<*>? {
fun getDetail(@PathVariable id: String): ResponseEntity<ReturnData>? {
return service.getDetail(id)
}
@PostMapping(value = [""], produces = ["application/json"])
fun saveData(@Valid @RequestBody request: Tag): ResponseEntity<*>? {
fun saveData(@Valid @RequestBody request: Tag): ResponseEntity<ReturnData>? {
return service.saveData(request)
}
@PutMapping(value = ["{id}"], produces = ["application/json"])
fun updateData(@PathVariable id: String, @Valid @RequestBody request: Tag): ResponseEntity<*>? {
fun updateData(@PathVariable id: String, @Valid @RequestBody request: Tag): ResponseEntity<ReturnData>? {
return service.updateData(id, request)
}
......@@ -41,7 +42,7 @@ class TagController {
fun deleteData(
@Valid @RequestBody request: DeleteDataRequest,
httpServletRequest: HttpServletRequest
): ResponseEntity<*>? {
): ResponseEntity<ReturnData>? {
return service.deleteData(request, httpServletRequest)
}
}
......@@ -4,8 +4,8 @@ import id.co.sangkuriang.inovasi.daerah.master.model.response.ReturnData
import org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity
fun responseSuccess(message: String = "Success", data: Any? = null): ResponseEntity<*> {
return ResponseEntity<Any?>(
fun responseSuccess(message: String = "Success", data: Any? = null): ResponseEntity<ReturnData> {
return ResponseEntity<ReturnData>(
ReturnData(
success = true,
message = message,
......@@ -15,8 +15,8 @@ fun responseSuccess(message: String = "Success", data: Any? = null): ResponseEnt
)
}
fun responseCreated(message: String = "Created", data: Any? = null): ResponseEntity<*> {
return ResponseEntity<Any?>(
fun responseCreated(message: String = "Created", data: Any? = null): ResponseEntity<ReturnData> {
return ResponseEntity<ReturnData>(
ReturnData(
success = true,
message = message,
......@@ -26,8 +26,11 @@ fun responseCreated(message: String = "Created", data: Any? = null): ResponseEnt
)
}
fun responseInternalServerError(message: String = "Internal Server Error", data: Any? = null): ResponseEntity<*> {
return ResponseEntity<Any?>(
fun responseInternalServerError(
message: String = "Internal Server Error",
data: Any? = null
): ResponseEntity<ReturnData> {
return ResponseEntity<ReturnData>(
ReturnData(
success = false,
message = message,
......@@ -37,8 +40,8 @@ fun responseInternalServerError(message: String = "Internal Server Error", data:
)
}
fun responseNotFound(message: String = "Not Found", data: Any? = null): ResponseEntity<*> {
return ResponseEntity<Any?>(
fun responseNotFound(message: String = "Not Found", data: Any? = null): ResponseEntity<ReturnData> {
return ResponseEntity<ReturnData>(
ReturnData(
success = false,
message = message,
......@@ -48,8 +51,11 @@ fun responseNotFound(message: String = "Not Found", data: Any? = null): Response
)
}
fun responseUnprocessableEntity(message: String = "Unprocessable Entity", data: Any? = null): ResponseEntity<*> {
return ResponseEntity<Any?>(
fun responseUnprocessableEntity(
message: String = "Unprocessable Entity",
data: Any? = null
): ResponseEntity<ReturnData> {
return ResponseEntity<ReturnData>(
ReturnData(
success = false,
message = message,
......@@ -59,8 +65,8 @@ fun responseUnprocessableEntity(message: String = "Unprocessable Entity", data:
)
}
fun responseBadRequest(message: String = "Bad Request", data: Any? = null): ResponseEntity<*> {
return ResponseEntity<Any?>(
fun responseBadRequest(message: String = "Bad Request", data: Any? = null): ResponseEntity<ReturnData> {
return ResponseEntity<ReturnData>(
ReturnData(
success = false,
message = message,
......
......@@ -3,24 +3,26 @@ package id.co.sangkuriang.inovasi.daerah.master.service
import id.co.sangkuriang.inovasi.daerah.master.model.request.ApplicationCategoryRequest
import id.co.sangkuriang.inovasi.daerah.master.model.request.DeleteDataRequest
import id.co.sangkuriang.inovasi.daerah.master.model.request.PaginationRequest
import id.co.sangkuriang.inovasi.daerah.master.model.response.ReturnData
import org.hibernate.validator.internal.metadata.aggregated.ReturnValueMetaData
import org.springframework.http.ResponseEntity
import javax.servlet.http.HttpServletRequest
interface ApplicationCategoryService {
fun getAll(page: PaginationRequest): ResponseEntity<*>?
fun getAll(page: PaginationRequest): ResponseEntity<ReturnData>
fun getDetail(id: String): ResponseEntity<*>?
fun getDetail(id: String): ResponseEntity<ReturnData>
fun saveData(request: ApplicationCategoryRequest, httpServletRequest: HttpServletRequest): ResponseEntity<*>?
fun saveData(request: ApplicationCategoryRequest, httpServletRequest: HttpServletRequest): ResponseEntity<ReturnData>
fun updateData(
id: String,
request: ApplicationCategoryRequest,
httpServletRequest: HttpServletRequest
): ResponseEntity<*>?
): ResponseEntity<ReturnData>
fun deleteData(request: DeleteDataRequest, httpServletRequest: HttpServletRequest): ResponseEntity<*>?
fun deleteData(request: DeleteDataRequest, httpServletRequest: HttpServletRequest): ResponseEntity<ReturnData>
fun count(): ResponseEntity<*>?
fun count(): ResponseEntity<ReturnData>
}
......@@ -3,25 +3,26 @@ package id.co.sangkuriang.inovasi.daerah.master.service
import id.co.sangkuriang.inovasi.daerah.master.model.request.DeleteDataRequest
import id.co.sangkuriang.inovasi.daerah.master.model.request.Pagination2Request
import id.co.sangkuriang.inovasi.daerah.master.model.request.PaginationRequest
import id.co.sangkuriang.inovasi.daerah.master.model.response.ReturnData
import id.co.sangkuriang.inovasi.daerah.master.pojo.Province
import org.springframework.http.ResponseEntity
import javax.servlet.http.HttpServletRequest
interface ProvinceService {
fun getAll(page: PaginationRequest): ResponseEntity<*>?
fun getAll(page: PaginationRequest): ResponseEntity<ReturnData>
fun getDetail(id: String): ResponseEntity<*>?
fun getDetail(id: String): ResponseEntity<ReturnData>
fun saveData(request: Province): ResponseEntity<*>?
fun saveData(request: Province): ResponseEntity<ReturnData>
fun updateData(id: String, request: Province): ResponseEntity<*>?
fun updateData(id: String, request: Province): ResponseEntity<ReturnData>
fun deleteData(request: DeleteDataRequest, httpServletRequest: HttpServletRequest): ResponseEntity<*>?
fun deleteData(request: DeleteDataRequest, httpServletRequest: HttpServletRequest): ResponseEntity<ReturnData>
fun datatable(req: Pagination2Request): ResponseEntity<*>?
fun datatable(req: Pagination2Request): ResponseEntity<ReturnData>
fun getByName(name: String): ResponseEntity<*>?
fun getByName(name: String): ResponseEntity<ReturnData>
fun count(): ResponseEntity<*>?
fun count(): ResponseEntity<ReturnData>
}
......@@ -2,19 +2,20 @@ package id.co.sangkuriang.inovasi.daerah.master.service
import id.co.sangkuriang.inovasi.daerah.master.model.request.DeleteDataRequest
import id.co.sangkuriang.inovasi.daerah.master.model.request.PaginationRequest
import id.co.sangkuriang.inovasi.daerah.master.model.response.ReturnData
import id.co.sangkuriang.inovasi.daerah.master.pojo.Regency
import org.springframework.http.ResponseEntity
import javax.servlet.http.HttpServletRequest
interface RegencyService {
fun getAll(page: PaginationRequest): ResponseEntity<*>?
fun getAll(page: PaginationRequest): ResponseEntity<ReturnData>
fun getDetail(id: String): ResponseEntity<*>?
fun getDetail(id: String): ResponseEntity<ReturnData>
fun saveData(request: Regency): ResponseEntity<*>?
fun saveData(request: Regency): ResponseEntity<ReturnData>
fun updateData(id: String, request: Regency): ResponseEntity<*>?
fun updateData(id: String, request: Regency): ResponseEntity<ReturnData>
fun deleteData(request: DeleteDataRequest, httpServletRequest: HttpServletRequest): ResponseEntity<*>?
fun deleteData(request: DeleteDataRequest, httpServletRequest: HttpServletRequest): ResponseEntity<ReturnData>
}
......@@ -2,19 +2,20 @@ package id.co.sangkuriang.inovasi.daerah.master.service
import id.co.sangkuriang.inovasi.daerah.master.model.request.DeleteDataRequest
import id.co.sangkuriang.inovasi.daerah.master.model.request.PaginationRequest
import id.co.sangkuriang.inovasi.daerah.master.model.response.ReturnData
import id.co.sangkuriang.inovasi.daerah.master.pojo.Tag
import org.springframework.http.ResponseEntity
import javax.servlet.http.HttpServletRequest
interface TagService {
fun getAll(page: PaginationRequest): ResponseEntity<*>?
fun getAll(page: PaginationRequest): ResponseEntity<ReturnData>
fun getDetail(id: String): ResponseEntity<*>?
fun getDetail(id: String): ResponseEntity<ReturnData>
fun saveData(request: Tag): ResponseEntity<*>?
fun saveData(request: Tag): ResponseEntity<ReturnData>
fun updateData(id: String, request: Tag): ResponseEntity<*>?
fun updateData(id: String, request: Tag): ResponseEntity<ReturnData>
fun deleteData(request: DeleteDataRequest, httpServletRequest: HttpServletRequest): ResponseEntity<*>?
fun deleteData(request: DeleteDataRequest, httpServletRequest: HttpServletRequest): ResponseEntity<ReturnData>
}
......@@ -31,7 +31,7 @@ class ApplicationCategoryServiceImpl : ApplicationCategoryService {
@Autowired
private lateinit var repo: ApplicationCategoryRepository
override fun getAll(page: PaginationRequest): ResponseEntity<*>? {
override fun getAll(page: PaginationRequest): ResponseEntity<ReturnData> {
return try {
val page: Page<ApplicationCategory?>? = if (page.enablePage!! == 1) {
var direction: Sort.Direction = Sort.Direction.ASC
......@@ -54,7 +54,7 @@ class ApplicationCategoryServiceImpl : ApplicationCategoryService {
}
}
override fun getDetail(id: String): ResponseEntity<*>? {
override fun getDetail(id: String): ResponseEntity<ReturnData> {
try {
val data = repo.findByIdAndActive(id)
if (data.isPresent) {
......@@ -69,7 +69,7 @@ class ApplicationCategoryServiceImpl : ApplicationCategoryService {
override fun saveData(
request: ApplicationCategoryRequest,
httpServletRequest: HttpServletRequest
): ResponseEntity<*>? {
): ResponseEntity<ReturnData> {
return try {
validateRequest(request)
val save = ApplicationCategory()
......@@ -92,7 +92,7 @@ class ApplicationCategoryServiceImpl : ApplicationCategoryService {
id: String,
request: ApplicationCategoryRequest,
httpServletRequest: HttpServletRequest
): ResponseEntity<*>? {
): ResponseEntity<ReturnData> {
try {
val data = repo.findByIdAndActive(id)
if (data.isPresent) {
......@@ -121,7 +121,7 @@ class ApplicationCategoryServiceImpl : ApplicationCategoryService {
}
}
override fun deleteData(request: DeleteDataRequest, httpServletRequest: HttpServletRequest): ResponseEntity<*>? {
override fun deleteData(request: DeleteDataRequest, httpServletRequest: HttpServletRequest): ResponseEntity<ReturnData> {
try {
val data = repo.findByIdAndActive(request.id)
if (data.isPresent) {
......@@ -154,7 +154,7 @@ class ApplicationCategoryServiceImpl : ApplicationCategoryService {
}
}
override fun count(): ResponseEntity<*>? {
override fun count(): ResponseEntity<ReturnData> {
return try {
responseSuccess(data = repo.getCount())
} catch (e: Exception) {
......
......@@ -40,7 +40,7 @@ class ProvinceServiceImpl : ProvinceService {
@Autowired
private lateinit var repoNative: ProvinceRepositoryNative
override fun getAll(page: PaginationRequest): ResponseEntity<*>? {
override fun getAll(page: PaginationRequest): ResponseEntity<ReturnData> {
return try {
val page: Page<Province?>? = if (page.enablePage!! == 1) {
var direction: Sort.Direction = Sort.Direction.ASC
......@@ -63,7 +63,7 @@ class ProvinceServiceImpl : ProvinceService {
}
}
override fun datatable(req: Pagination2Request): ResponseEntity<*>? {
override fun datatable(req: Pagination2Request): ResponseEntity<ReturnData> {
return try {
responseSuccess(data = repoNative.getPage(req))
} catch (e: Exception) {
......@@ -71,7 +71,7 @@ class ProvinceServiceImpl : ProvinceService {
}
}
override fun getByName(name: String): ResponseEntity<*>? {
override fun getByName(name: String): ResponseEntity<ReturnData> {
try {
val data = repo.findByName(name.trim())
if (data.isPresent) {
......@@ -83,7 +83,7 @@ class ProvinceServiceImpl : ProvinceService {
}
}
override fun count(): ResponseEntity<*>? {
override fun count(): ResponseEntity<ReturnData> {
return try {
responseSuccess(data = repo.getCount())
} catch (e: Exception) {
......@@ -91,7 +91,7 @@ class ProvinceServiceImpl : ProvinceService {
}
}
override fun getDetail(id: String): ResponseEntity<*>? {
override fun getDetail(id: String): ResponseEntity<ReturnData> {
try {
val data = repo.findByIdAndActive(id)
if (data.isPresent) {
......@@ -103,7 +103,7 @@ class ProvinceServiceImpl : ProvinceService {
}
}
override fun saveData(request: Province): ResponseEntity<*>? {
override fun saveData(request: Province): ResponseEntity<ReturnData> {
return try {
validateRequest(request)
val save = Province()
......@@ -115,7 +115,7 @@ class ProvinceServiceImpl : ProvinceService {
}
}
override fun updateData(id: String, request: Province): ResponseEntity<*>? {
override fun updateData(id: String, request: Province): ResponseEntity<ReturnData> {
try {
val data = repo.findByIdAndActive(id)
if (data.isPresent) {
......@@ -132,7 +132,10 @@ class ProvinceServiceImpl : ProvinceService {
}
}
override fun deleteData(request: DeleteDataRequest, httpServletRequest: HttpServletRequest): ResponseEntity<*>? {
override fun deleteData(
request: DeleteDataRequest,
httpServletRequest: HttpServletRequest
): ResponseEntity<ReturnData> {
try {
val data = repo.findByIdAndActive(request.id)
if (data.isPresent) {
......
......@@ -31,7 +31,7 @@ class RegencyServiceImpl : RegencyService {
@Autowired
private lateinit var repo: RegencyRepository
override fun getAll(page: PaginationRequest): ResponseEntity<*>? {
override fun getAll(page: PaginationRequest): ResponseEntity<ReturnData> {
return try {
val page: Page<Regency?>? = if (page.enablePage!! == 1) {
var direction: Sort.Direction = Sort.Direction.ASC
......@@ -54,7 +54,7 @@ class RegencyServiceImpl : RegencyService {
}
}
override fun getDetail(id: String): ResponseEntity<*>? {
override fun getDetail(id: String): ResponseEntity<ReturnData> {
try {
val data = repo.findByIdAndActive(id)
if (data.isPresent) {
......@@ -66,7 +66,7 @@ class RegencyServiceImpl : RegencyService {
}
}
override fun saveData(request: Regency): ResponseEntity<*>? {
override fun saveData(request: Regency): ResponseEntity<ReturnData> {
return try {
validateRequest(request)
val save = Regency()
......@@ -79,7 +79,7 @@ class RegencyServiceImpl : RegencyService {
}
}
override fun updateData(id: String, request: Regency): ResponseEntity<*>? {
override fun updateData(id: String, request: Regency): ResponseEntity<ReturnData> {
try {
val data = repo.findByIdAndActive(id)
if (data.isPresent) {
......@@ -96,7 +96,7 @@ class RegencyServiceImpl : RegencyService {
}
}
override fun deleteData(request: DeleteDataRequest, httpServletRequest: HttpServletRequest): ResponseEntity<*>? {
override fun deleteData(request: DeleteDataRequest, httpServletRequest: HttpServletRequest): ResponseEntity<ReturnData> {
try {
val data = repo.findByIdAndActive(request.id)
if (data.isPresent) {
......
......@@ -31,7 +31,7 @@ class TagServiceImpl : TagService {
@Autowired
private lateinit var repo: TagRepository
override fun getAll(page: PaginationRequest): ResponseEntity<*>? {
override fun getAll(page: PaginationRequest): ResponseEntity<ReturnData> {
return try {
val page: Page<Tag?>? = if (page.enablePage!! == 1) {
var direction: Sort.Direction = Sort.Direction.ASC
......@@ -54,7 +54,7 @@ class TagServiceImpl : TagService {
}
}
override fun getDetail(id: String): ResponseEntity<*>? {
override fun getDetail(id: String): ResponseEntity<ReturnData> {
try {
val data = repo.findByIdAndActive(id)
if (data.isPresent) {
......@@ -66,7 +66,7 @@ class TagServiceImpl : TagService {
}
}
override fun saveData(request: Tag): ResponseEntity<*>? {
override fun saveData(request: Tag): ResponseEntity<ReturnData> {
return try {
validateRequest(request)
val save = Tag()
......@@ -78,7 +78,7 @@ class TagServiceImpl : TagService {
}
}
override fun updateData(id: String, request: Tag): ResponseEntity<*>? {
override fun updateData(id: String, request: Tag): ResponseEntity<ReturnData> {
try {
val data = repo.findByIdAndActive(id)
if (data.isPresent) {
......@@ -95,7 +95,7 @@ class TagServiceImpl : TagService {
}
}
override fun deleteData(request: DeleteDataRequest, httpServletRequest: HttpServletRequest): ResponseEntity<*>? {
override fun deleteData(request: DeleteDataRequest, httpServletRequest: HttpServletRequest): ResponseEntity<ReturnData> {
try {
val data = repo.findByIdAndActive(request.id)
if (data.isPresent) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment