Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ target/
!**/src/main/**/target/
!**/src/test/**/target/

logs/

### STS ###
.apt_generated
.classpath
Expand Down Expand Up @@ -34,4 +32,7 @@ build/
### VS Code ###
.vscode/

.env
.env

# Logs
logs/cyberwatch.log
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ private Staff createStaff(String ssn, String firstName, String lastName, String
staff.setPhoneNumber(phone);
staff.setRole(role);
staff.setDepartment(department);
staff.setStatus("OFFLINE");
staff.setPassword(passwordEncoder.encode(rawPassword));
return staff;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
import org.example.cyberwatch.features.activitylog.service.ActivityLogService;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ public class Staff {
@Column(name = "profile_picture_url")
private String profilePictureUrl;

@Column(name = "status")
private String status;
@Column(name = "status", nullable = false)
private String status = "OFFLINE";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-- Set default value for status and update existing NULL values
UPDATE staff SET status = 'OFFLINE' WHERE status IS NULL;

ALTER TABLE staff ALTER COLUMN status SET DEFAULT 'OFFLINE';
ALTER TABLE staff ALTER COLUMN status SET NOT NULL;
2 changes: 1 addition & 1 deletion src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

<!-- Minska brus från Spring/Hibernate i produktion -->
<logger name="org.springframework" level="WARN"/>
<logger name="org.hibernate" level="WARN"/>
<logger name="org.hibernate" level="WARN"/>

<!-- Er applikationskod loggar på INFO -->
<logger name="org.example.cyberwatch" level="INFO"/>
Expand Down
Loading
Loading