Class SiteUserController

java.lang.Object
com.fyp.tauceti.controller.SiteUserController

@RestController public class SiteUserController extends Object
Spring Controller for interacting with the SITE_USER database table through web APIs
See Also:
  • Constructor Details

    • SiteUserController

      public SiteUserController(SiteUserRepository repository, LoginRecordRepository loginRecordRepository)
      Paramterised Constructor
      Parameters:
      repository - SiteUserRepository object for CRUD operations on SITE_USER database table
      loginRecordRepository - LoginRecordRepository object for CRUD operations on LOGIN_RECORD database table
  • Method Details

    • newSiteUser

      @CrossOrigin(origins="http://localhost:4200") @PostMapping("/new-user") public SiteUser newSiteUser(@RequestBody SiteUser newSiteUser)
      "new-user" endpoint: Accepts POST requests containing a new SiteUser details
      Parameters:
      newSiteUser - New SiteUser to be added to the database
      Returns:
      The saved SiteUser
    • loginSiteUser

      @CrossOrigin(origins="http://localhost:4200") @PostMapping("/login") public SiteUser loginSiteUser(@RequestBody SiteUser loginSiteUser)
      "/login" endpoint: Accepts POST request when a user tries to login to the site
      Parameters:
      loginSiteUser - The details of the SiteUser logging in
      Returns:
      SiteUser record if login is valid, else a blank SiteUser record
    • deleteSiteUser

      @DeleteMapping("/users/delete-user") public void deleteSiteUser(@RequestBody SiteUser siteUser)
      "/users/delete-user" endpoint: Accepts DELETE requests for deleting a SiteUser record from the database
      Parameters:
      siteUser - the SiteUser to be deleted