Package com.fyp.tauceti.controller
Class SiteUserController
java.lang.Object
com.fyp.tauceti.controller.SiteUserController
Spring Controller for interacting with the SITE_USER database table through web APIs
- See Also:
-
SiteUserRepository
LoginRecordRepository
BCryptPasswordEncoder
-
Constructor Summary
ConstructorDescriptionSiteUserController
(SiteUserRepository repository, LoginRecordRepository loginRecordRepository) Paramterised Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoid
deleteSiteUser
(SiteUser siteUser) "/users/delete-user" endpoint: Accepts DELETE requests for deleting a SiteUser record from the databaseloginSiteUser
(SiteUser loginSiteUser) "/login" endpoint: Accepts POST request when a user tries to login to the sitenewSiteUser
(SiteUser newSiteUser) "new-user" endpoint: Accepts POST requests containing a new SiteUser details
-
Constructor Details
-
SiteUserController
public SiteUserController(SiteUserRepository repository, LoginRecordRepository loginRecordRepository) Paramterised Constructor- Parameters:
repository
- SiteUserRepository object for CRUD operations on SITE_USER database tableloginRecordRepository
- 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
"/users/delete-user" endpoint: Accepts DELETE requests for deleting a SiteUser record from the database- Parameters:
siteUser
- the SiteUser to be deleted
-