aa
This commit is contained in:
@@ -2,6 +2,7 @@ package com.sasiedzi.event.web.rest;
|
||||
|
||||
import com.sasiedzi.event.domain.Charge;
|
||||
import com.sasiedzi.event.repository.ChargeRepository;
|
||||
import com.sasiedzi.event.security.AuthoritiesConstants;
|
||||
import com.sasiedzi.event.web.rest.errors.BadRequestAlertException;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
@@ -14,6 +15,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.annotation.Secured;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import tech.jhipster.web.util.HeaderUtil;
|
||||
@@ -25,6 +27,7 @@ import tech.jhipster.web.util.ResponseUtil;
|
||||
@RestController
|
||||
@RequestMapping("/api/charges")
|
||||
@Transactional
|
||||
@Secured({ AuthoritiesConstants.ADMIN })
|
||||
public class ChargeResource {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ChargeResource.class);
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.sasiedzi.event.web.rest;
|
||||
|
||||
import com.sasiedzi.event.domain.Event;
|
||||
import com.sasiedzi.event.repository.EventRepository;
|
||||
import com.sasiedzi.event.security.AuthoritiesConstants;
|
||||
import com.sasiedzi.event.service.EventService;
|
||||
import com.sasiedzi.event.web.rest.errors.BadRequestAlertException;
|
||||
import jakarta.validation.Valid;
|
||||
@@ -15,6 +16,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.annotation.Secured;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import tech.jhipster.web.util.HeaderUtil;
|
||||
import tech.jhipster.web.util.ResponseUtil;
|
||||
@@ -50,6 +52,7 @@ public class EventResource {
|
||||
* @throws URISyntaxException if the Location URI syntax is incorrect.
|
||||
*/
|
||||
@PostMapping("")
|
||||
@Secured({ AuthoritiesConstants.ADMIN })
|
||||
public ResponseEntity<Event> createEvent(@Valid @RequestBody Event event) throws URISyntaxException {
|
||||
LOG.debug("REST request to save Event : {}", event);
|
||||
if (event.getId() != null) {
|
||||
@@ -62,6 +65,7 @@ public class EventResource {
|
||||
}
|
||||
|
||||
@PostMapping("/{id}/settle")
|
||||
@Secured({ AuthoritiesConstants.ADMIN })
|
||||
public ResponseEntity<Optional<Event>> settleEvent(@RequestBody Optional<Event> event) throws URISyntaxException {
|
||||
event = eventService.settle(event.orElse(null));
|
||||
return ResponseEntity.ok()
|
||||
@@ -80,6 +84,7 @@ public class EventResource {
|
||||
* @throws URISyntaxException if the Location URI syntax is incorrect.
|
||||
*/
|
||||
@PutMapping("/{id}")
|
||||
@Secured({ AuthoritiesConstants.ADMIN })
|
||||
public ResponseEntity<Event> updateEvent(@PathVariable(value = "id", required = false) final Long id, @Valid @RequestBody Event event)
|
||||
throws URISyntaxException {
|
||||
LOG.debug("REST request to update Event : {}, {}", id, event);
|
||||
@@ -111,6 +116,7 @@ public class EventResource {
|
||||
* or with status {@code 500 (Internal Server Error)} if the event couldn't be updated.
|
||||
* @throws URISyntaxException if the Location URI syntax is incorrect.
|
||||
*/
|
||||
@Secured({ AuthoritiesConstants.ADMIN })
|
||||
@PatchMapping(value = "/{id}", consumes = { "application/json", "application/merge-patch+json" })
|
||||
public ResponseEntity<Event> partialUpdateEvent(
|
||||
@PathVariable(value = "id", required = false) final Long id,
|
||||
@@ -167,6 +173,7 @@ public class EventResource {
|
||||
* @return the {@link ResponseEntity} with status {@code 204 (NO_CONTENT)}.
|
||||
*/
|
||||
@DeleteMapping("/{id}")
|
||||
@Secured({ AuthoritiesConstants.ADMIN })
|
||||
public ResponseEntity<Void> deleteEvent(@PathVariable("id") Long id) {
|
||||
LOG.debug("REST request to delete Event : {}", id);
|
||||
eventService.delete(id);
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.sasiedzi.event.web.rest;
|
||||
|
||||
import com.sasiedzi.event.domain.TransactionItem;
|
||||
import com.sasiedzi.event.repository.TransactionItemRepository;
|
||||
import com.sasiedzi.event.security.AuthoritiesConstants;
|
||||
import com.sasiedzi.event.web.rest.errors.BadRequestAlertException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
@@ -12,6 +13,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.annotation.Secured;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import tech.jhipster.web.util.HeaderUtil;
|
||||
@@ -23,6 +25,7 @@ import tech.jhipster.web.util.ResponseUtil;
|
||||
@RestController
|
||||
@RequestMapping("/api/transaction-items")
|
||||
@Transactional
|
||||
@Secured({ AuthoritiesConstants.ADMIN })
|
||||
public class TransactionItemResource {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(TransactionItemResource.class);
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.sasiedzi.event.web.rest;
|
||||
|
||||
import com.sasiedzi.event.domain.*;
|
||||
import com.sasiedzi.event.repository.TransactionRepository;
|
||||
import com.sasiedzi.event.security.AuthoritiesConstants;
|
||||
import com.sasiedzi.event.web.rest.errors.BadRequestAlertException;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.URI;
|
||||
@@ -12,6 +13,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.annotation.Secured;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import tech.jhipster.web.util.HeaderUtil;
|
||||
@@ -46,6 +48,7 @@ public class TransactionResource {
|
||||
* @throws URISyntaxException if the Location URI syntax is incorrect.
|
||||
*/
|
||||
@PostMapping("")
|
||||
@Secured({ AuthoritiesConstants.ADMIN })
|
||||
public ResponseEntity<Transaction> createTransaction(@RequestBody Transaction transaction) throws URISyntaxException {
|
||||
LOG.debug("REST request to save Transaction : {}", transaction);
|
||||
if (transaction.getId() != null) {
|
||||
@@ -67,6 +70,7 @@ public class TransactionResource {
|
||||
* or with status {@code 500 (Internal Server Error)} if the transaction couldn't be updated.
|
||||
* @throws URISyntaxException if the Location URI syntax is incorrect.
|
||||
*/
|
||||
@Secured({ AuthoritiesConstants.ADMIN })
|
||||
@PutMapping("/{id}")
|
||||
public ResponseEntity<Transaction> updateTransaction(
|
||||
@PathVariable(value = "id", required = false) final Long id,
|
||||
@@ -101,6 +105,7 @@ public class TransactionResource {
|
||||
* or with status {@code 500 (Internal Server Error)} if the transaction couldn't be updated.
|
||||
* @throws URISyntaxException if the Location URI syntax is incorrect.
|
||||
*/
|
||||
@Secured({ AuthoritiesConstants.ADMIN })
|
||||
@PatchMapping(value = "/{id}", consumes = { "application/json", "application/merge-patch+json" })
|
||||
public ResponseEntity<Transaction> partialUpdateTransaction(
|
||||
@PathVariable(value = "id", required = false) final Long id,
|
||||
@@ -277,6 +282,7 @@ public class TransactionResource {
|
||||
* @return the {@link ResponseEntity} with status {@code 204 (NO_CONTENT)}.
|
||||
*/
|
||||
@DeleteMapping("/{id}")
|
||||
@Secured({ AuthoritiesConstants.ADMIN })
|
||||
public ResponseEntity<Void> deleteTransaction(@PathVariable("id") Long id) {
|
||||
LOG.debug("REST request to delete Transaction : {}", id);
|
||||
transactionRepository.deleteById(id);
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.sasiedzi.event.domain.CurrentUserHolder;
|
||||
import com.sasiedzi.event.domain.User;
|
||||
import com.sasiedzi.event.domain.UserAccount;
|
||||
import com.sasiedzi.event.repository.UserAccountRepository;
|
||||
import com.sasiedzi.event.security.AuthoritiesConstants;
|
||||
import com.sasiedzi.event.service.EventService;
|
||||
import com.sasiedzi.event.service.UserService;
|
||||
import com.sasiedzi.event.web.rest.errors.BadRequestAlertException;
|
||||
@@ -17,6 +18,7 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.annotation.Secured;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -53,6 +55,7 @@ public class UserAccountResource {
|
||||
* @throws URISyntaxException if the Location URI syntax is incorrect.
|
||||
*/
|
||||
@PostMapping("")
|
||||
@Secured({ AuthoritiesConstants.ADMIN })
|
||||
public ResponseEntity<UserAccount> createUserAccount(@RequestBody UserAccount userAccount) throws URISyntaxException {
|
||||
LOG.debug("REST request to save UserAccount : {}", userAccount);
|
||||
if (userAccount.getId() != null) {
|
||||
@@ -74,6 +77,7 @@ public class UserAccountResource {
|
||||
* or with status {@code 500 (Internal Server Error)} if the userAccount couldn't be updated.
|
||||
* @throws URISyntaxException if the Location URI syntax is incorrect.
|
||||
*/
|
||||
@Secured({ AuthoritiesConstants.ADMIN })
|
||||
@PutMapping("/{id}")
|
||||
public ResponseEntity<UserAccount> updateUserAccount(
|
||||
@PathVariable(value = "id", required = false) final Long id,
|
||||
@@ -108,6 +112,7 @@ public class UserAccountResource {
|
||||
* or with status {@code 500 (Internal Server Error)} if the userAccount couldn't be updated.
|
||||
* @throws URISyntaxException if the Location URI syntax is incorrect.
|
||||
*/
|
||||
@Secured({ AuthoritiesConstants.ADMIN })
|
||||
@PatchMapping(value = "/{id}", consumes = { "application/json", "application/merge-patch+json" })
|
||||
public ResponseEntity<UserAccount> partialUpdateUserAccount(
|
||||
@PathVariable(value = "id", required = false) final Long id,
|
||||
@@ -188,6 +193,7 @@ public class UserAccountResource {
|
||||
* @return the {@link ResponseEntity} with status {@code 204 (NO_CONTENT)}.
|
||||
*/
|
||||
@DeleteMapping("/{id}")
|
||||
@Secured({ AuthoritiesConstants.ADMIN })
|
||||
public ResponseEntity<Void> deleteUserAccount(@PathVariable("id") Long id) {
|
||||
LOG.debug("REST request to delete UserAccount : {}", id);
|
||||
userAccountRepository.deleteById(id);
|
||||
|
||||
Reference in New Issue
Block a user