Skip to content

Commit

Permalink
flyway stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
tofiksa committed Jun 15, 2024
1 parent 02f4480 commit bffe28a
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package no.josefushighscore.controller;

import jakarta.validation.Valid;
import no.josefushighscore.dto.LoginUserDto;
import no.josefushighscore.dto.UserDto;
import no.josefushighscore.exception.BadRequestException;
import no.josefushighscore.service.APIResponse;
import no.josefushighscore.service.UserLoginService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
Expand All @@ -23,6 +24,8 @@ public class AuthenticationController {
@Autowired
UserLoginService loginService;

Logger LOG = LoggerFactory.getLogger(AuthenticationController.class);

@Secured("ROLE_ANONYMOUS")
@PostMapping("/signin")
public ResponseEntity<LoginUserDto> signin(@RequestBody LoginUserDto data) throws AuthenticationException {
Expand All @@ -35,9 +38,10 @@ public ResponseEntity<LoginUserDto> signin(@RequestBody LoginUserDto data) throw

@Secured("ROLE_ANONYMOUS")
@PostMapping("/register")
public ResponseEntity registerNewUserAccount(@Valid @RequestBody UserDto accountDto) throws BadRequestException {
public ResponseEntity registerNewUserAccount(@RequestBody UserDto accountDto) throws BadRequestException {

APIResponse apiResponse = new APIResponse();
LOG.info(String.valueOf(accountDto));
loginService.registerNewUserAccount(accountDto);
apiResponse.setStatus(HttpStatus.CREATED);
apiResponse.setMessage("User registered successfully");
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/no/josefushighscore/dto/UserDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class UserDto {
@JsonProperty("username")
private String username;

@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
@JsonProperty("password")
private String password;

@JsonProperty("firstname")
Expand Down
3 changes: 1 addition & 2 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@ spring:
default-property-inclusion: non_empty
flyway:
url: ${spring.datasource.url}
schemas: josefushighscore
enabled: true
locations: classpath:/db/migration
user: ${SUPABASE_JOSEFUS_DB_USER}
password: ${SUPABASE_JOSEFUS_DB_PWD}
baseline-on-migrate: true
baseline-version: '0'
jwt:
secret: ${JOSEFUS_JWT_SECRET}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
CREATE SCHEMA IF NOT EXISTS josefus;

CREATE TABLE IF NOT EXISTS USER (
user_id bigint NOT NULL,
email varchar(255),
Expand Down

0 comments on commit bffe28a

Please sign in to comment.