setttle
This commit is contained in:
@@ -2,6 +2,7 @@ package com.sasiedzi.event.service;
|
||||
|
||||
import com.sasiedzi.event.domain.Event;
|
||||
import com.sasiedzi.event.repository.EventRepository;
|
||||
import jakarta.validation.Valid;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import org.slf4j.Logger;
|
||||
@@ -111,4 +112,8 @@ public class EventService {
|
||||
LOG.debug("Request to delete Event : {}", id);
|
||||
eventRepository.deleteById(id);
|
||||
}
|
||||
|
||||
public Optional<Event> settle(@Valid Event event) {
|
||||
return eventRepository.findById(event.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,6 +61,14 @@ public class EventResource {
|
||||
.body(event);
|
||||
}
|
||||
|
||||
@PostMapping("/{id}/settle")
|
||||
public ResponseEntity<Optional<Event>> settleEvent(@RequestBody Optional<Event> event) throws URISyntaxException {
|
||||
event = eventService.settle(event.orElse(null));
|
||||
return ResponseEntity.ok()
|
||||
.headers(HeaderUtil.createEntityUpdateAlert(applicationName, false, ENTITY_NAME, event.get().getId().toString()))
|
||||
.body(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@code PUT /events/:id} : Updates an existing event.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user