Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
egcodes committed Apr 12, 2024
1 parent 65fbf4f commit 3b3ca52
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 4 deletions.
10 changes: 7 additions & 3 deletions nginx/hackerupdates.com.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
server {
listen 80;
listen [::]:80;
server_name hackerupdate.com www.hackerupdates.com;
server_name hackerupdates.com www.hackerupdates.com;

location /api {
proxy_pass http://hsw-service:8080;
Expand All @@ -19,17 +19,21 @@ server {
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name hackerupdate.com www.hackerupdates.com;
server_name hackerupdates.com www.hackerupdates.com;

ssl_certificate /etc/ssl/certs/server.pem;
ssl_certificate_key /etc/ssl/private/server.key;

location / {
rewrite ^/([^\.]+)$ /$1.html;
if ($http_host !~ "^www.hackerupdates.com") {
rewrite ^(.*)$ https://www.$server_name$1;
}
rewrite ^/([^\.]+)$ /$1.html break;
}

location /api {
proxy_pass http://hsw-service:8080;
}


}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.hackerupdates.hsw.domain.entity;

import java.io.Serial;
import java.io.Serializable;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
Expand All @@ -24,6 +25,7 @@
@Getter
public class Activity implements Serializable {

@Serial
private static final long serialVersionUID = -2241699815447690916L;

@Id
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.hackerupdates.hsw.domain.entity;

import java.io.Serial;
import java.io.Serializable;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
Expand All @@ -24,6 +25,7 @@
@Getter
public class Connection implements Serializable {

@Serial
private static final long serialVersionUID = 1858746340416571229L;

@Id
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/hackerupdates/hsw/domain/entity/Person.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.hackerupdates.hsw.domain.entity;

import com.hackerupdates.hsw.enums.Status;

import java.io.Serial;
import java.time.Instant;
import lombok.*;

Expand All @@ -18,6 +20,7 @@
@Setter
public class Person implements Serializable {

@Serial
private static final long serialVersionUID = 5581667625001993382L;

@Id
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/hackerupdates/hsw/domain/entity/Share.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.hackerupdates.hsw.domain.entity;

import java.io.Serial;
import java.io.Serializable;
import java.time.Instant;
import jakarta.persistence.Entity;
Expand All @@ -26,6 +27,7 @@
@Getter
public class Share implements Serializable {

@Serial
private static final long serialVersionUID = -445626973360837740L;

@Id
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/hackerupdates/hsw/domain/entity/Token.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.hackerupdates.hsw.domain.entity;

import java.io.Serial;
import java.io.Serializable;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
Expand Down Expand Up @@ -27,6 +28,7 @@
})
public class Token implements Serializable {

@Serial
private static final long serialVersionUID = 3018776368057112848L;

@Id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public enum ValidationRule {
PERSON_NOT_FOUND("Person not found"),
PERSON_ALREADY_EXISTS("You cannot register with this username. Already registered"),
SHARE_NOT_FOUND("Share not found"),
SHARE_IS_BLANK("Share is blank"),
COULD_NOT_SIGN_IN("Could not sign in"),
INVALID_TOKEN("Invalid token"),
INVALID_USER_OR_PASSWORD("Username or password is incorrect"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import com.hackerupdates.hsw.service.person.PersonQueryService;
import com.hackerupdates.hsw.service.share.ShareQueryService;
import java.util.List;
import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public class ShareCommandService {
public Share add(Long personId, Share share) {
share.setCreatedTime(Instant.now());
share.setPersonId(personId);
if (share.getText().isBlank())
throw new HswException(ValidationRule.SHARE_IS_BLANK);
return shareRepository.save(share);
}

Expand Down

0 comments on commit 3b3ca52

Please sign in to comment.