Search in sources :

Example 6 with UserExt

use of com.furyviewer.domain.UserExt in project FuryViewer by TheDoctor-95.

the class UserExtResource method createUserExt.

/**
 * POST  /user-exts : Create a new userExt.
 *
 * @param userExt the userExt to create
 * @return the ResponseEntity with status 201 (Created) and with body the new userExt, or with status 400 (Bad Request) if the userExt has already an ID
 * @throws URISyntaxException if the Location URI syntax is incorrect
 */
@PostMapping("/user-exts")
@Timed
public ResponseEntity<UserExt> createUserExt(@RequestBody UserExt userExt) throws URISyntaxException {
    log.debug("REST request to save UserExt : {}", userExt);
    if (userExt.getId() != null) {
        throw new BadRequestAlertException("A new userExt cannot already have an ID", ENTITY_NAME, "idexists");
    }
    UserExt result = userExtRepository.save(userExt);
    return ResponseEntity.created(new URI("/api/user-exts/" + result.getId())).headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString())).body(result);
}
Also used : BadRequestAlertException(com.furyviewer.web.rest.errors.BadRequestAlertException) UserExt(com.furyviewer.domain.UserExt) URI(java.net.URI) Timed(com.codahale.metrics.annotation.Timed)

Example 7 with UserExt

use of com.furyviewer.domain.UserExt in project FuryViewer by TheDoctor-95.

the class UserExtResource method updateUserExt.

/**
 * PUT  /user-exts : Updates an existing userExt.
 *
 * @param userExt the userExt to update
 * @return the ResponseEntity with status 200 (OK) and with body the updated userExt,
 * or with status 400 (Bad Request) if the userExt is not valid,
 * or with status 500 (Internal Server Error) if the userExt couldn't be updated
 * @throws URISyntaxException if the Location URI syntax is incorrect
 */
@PutMapping("/user-exts")
@Timed
public ResponseEntity<UserExt> updateUserExt(@RequestBody UserExt userExt) throws URISyntaxException {
    log.debug("REST request to update UserExt : {}", userExt);
    if (userExt.getId() == null) {
        return createUserExt(userExt);
    }
    UserExt result = userExtRepository.save(userExt);
    return ResponseEntity.ok().headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, userExt.getId().toString())).body(result);
}
Also used : UserExt(com.furyviewer.domain.UserExt) Timed(com.codahale.metrics.annotation.Timed)

Aggregations

UserExt (com.furyviewer.domain.UserExt)7 Timed (com.codahale.metrics.annotation.Timed)3 Test (org.junit.Test)3 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)3 Transactional (org.springframework.transaction.annotation.Transactional)3 Authority (com.furyviewer.domain.Authority)1 User (com.furyviewer.domain.User)1 BadRequestAlertException (com.furyviewer.web.rest.errors.BadRequestAlertException)1 URI (java.net.URI)1