From 4a10f5a411ef31d5c426da20e4f420868315ec2b Mon Sep 17 00:00:00 2001 From: Akram-Fahim Date: Mon, 4 Mar 2024 11:52:54 +0200 Subject: [PATCH 01/43] Created Users module, and added FreelancerRegister request and response --- .../requests/FreelancerRegisterRequest.java | 16 ++++++++++++++++ .../responses/FreelancerRegisterResponse.java | 9 +++++++++ 2 files changed, 25 insertions(+) create mode 100644 services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java create mode 100644 services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java diff --git a/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java b/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java new file mode 100644 index 00000000..b33c01d8 --- /dev/null +++ b/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java @@ -0,0 +1,16 @@ +package com.workup.users.requests; +import com.workup.shared.commands.CommandRequest; +import lombok.Builder; +import lombok.NonNull; + +import java.util.Date; + +@Builder +public class FreelancerRegisterRequest extends CommandRequest { + @NonNull String email; + @NonNull String passwordHash; + @NonNull String fullName; + String jobTitle; + String city; + Date birthDate; +} diff --git a/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java b/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java new file mode 100644 index 00000000..68c4d81e --- /dev/null +++ b/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java @@ -0,0 +1,9 @@ +package com.workup.users.responses; + +import com.workup.shared.commands.CommandResponse; +import lombok.NonNull; + +public class FreelancerRegisterResponse extends CommandResponse { + @NonNull boolean success; + String authToken; +} From 7c7b3b0eceabcb8e4216dfbd44bd5af249c4600e Mon Sep 17 00:00:00 2001 From: Akram-Fahim Date: Mon, 4 Mar 2024 12:43:14 +0200 Subject: [PATCH 02/43] Updated added builder annotation to FreelancerRegisterResponse and removed redundant @NonNull --- .../workup/users/responses/FreelancerRegisterResponse.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java b/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java index 68c4d81e..0a4c4dca 100644 --- a/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java +++ b/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java @@ -1,9 +1,10 @@ package com.workup.users.responses; import com.workup.shared.commands.CommandResponse; -import lombok.NonNull; +import lombok.Builder; +@Builder public class FreelancerRegisterResponse extends CommandResponse { - @NonNull boolean success; + boolean success; String authToken; } From 0ad77b0b859e8e226d885d0ab81543c2da8d4200 Mon Sep 17 00:00:00 2001 From: Akram-Fahim Date: Mon, 4 Mar 2024 13:07:02 +0200 Subject: [PATCH 03/43] Removed the NonNull annotation to make the class compatible with the Builder annotation --- .../workup/users/requests/FreelancerRegisterRequest.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java b/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java index b33c01d8..551ecfe2 100644 --- a/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java +++ b/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java @@ -1,15 +1,14 @@ package com.workup.users.requests; import com.workup.shared.commands.CommandRequest; import lombok.Builder; -import lombok.NonNull; import java.util.Date; @Builder public class FreelancerRegisterRequest extends CommandRequest { - @NonNull String email; - @NonNull String passwordHash; - @NonNull String fullName; + String email; + String passwordHash; + String fullName; String jobTitle; String city; Date birthDate; From 8e40d0036e8051112f67a33a1a689894ca8562e1 Mon Sep 17 00:00:00 2001 From: Akram-Fahim Date: Mon, 4 Mar 2024 15:08:48 +0200 Subject: [PATCH 04/43] Addressed @Ahmad45123's comments and created a test to verify the serialization process. --- .../users/requests/FreelancerRegisterRequest.java | 15 --------------- .../responses/FreelancerRegisterResponse.java | 10 ---------- .../users/requests/FreelancerLoginRequest.java | 9 +++++++++ 3 files changed, 9 insertions(+), 25 deletions(-) delete mode 100644 services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java delete mode 100644 services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java create mode 100644 shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java diff --git a/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java b/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java deleted file mode 100644 index 551ecfe2..00000000 --- a/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.workup.users.requests; -import com.workup.shared.commands.CommandRequest; -import lombok.Builder; - -import java.util.Date; - -@Builder -public class FreelancerRegisterRequest extends CommandRequest { - String email; - String passwordHash; - String fullName; - String jobTitle; - String city; - Date birthDate; -} diff --git a/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java b/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java deleted file mode 100644 index 0a4c4dca..00000000 --- a/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.workup.users.responses; - -import com.workup.shared.commands.CommandResponse; -import lombok.Builder; - -@Builder -public class FreelancerRegisterResponse extends CommandResponse { - boolean success; - String authToken; -} diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java new file mode 100644 index 00000000..b278398d --- /dev/null +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java @@ -0,0 +1,9 @@ +//package com.workup.users.requests; +// +//public class FreelancerLoginRequest { +// String email = ""; +// +// @NonNull +// @Builder.Default +// String passwordHash = ""; +//} From f9b11cf2487813bd69bb8f2fe0ffab8a848ea00a Mon Sep 17 00:00:00 2001 From: Akram-Fahim Date: Fri, 8 Mar 2024 22:39:44 +0200 Subject: [PATCH 05/43] Deleted commented file Signed-off-by: Akram-Fahim --- .../commands/users/requests/FreelancerLoginRequest.java | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java deleted file mode 100644 index b278398d..00000000 --- a/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java +++ /dev/null @@ -1,9 +0,0 @@ -//package com.workup.users.requests; -// -//public class FreelancerLoginRequest { -// String email = ""; -// -// @NonNull -// @Builder.Default -// String passwordHash = ""; -//} From 9f2bf078db8486ccdec536a6f5cc5f51e78b4c33 Mon Sep 17 00:00:00 2001 From: Akram-Fahim Date: Fri, 8 Mar 2024 22:41:14 +0200 Subject: [PATCH 06/43] Revert "Deleted commented file" This reverts commit f9b11cf2487813bd69bb8f2fe0ffab8a848ea00a. --- .../commands/users/requests/FreelancerLoginRequest.java | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java new file mode 100644 index 00000000..b278398d --- /dev/null +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java @@ -0,0 +1,9 @@ +//package com.workup.users.requests; +// +//public class FreelancerLoginRequest { +// String email = ""; +// +// @NonNull +// @Builder.Default +// String passwordHash = ""; +//} From 8c87e350adc00d888f5237180cdcbe3671134945 Mon Sep 17 00:00:00 2001 From: Akram-Fahim Date: Sun, 28 Apr 2024 20:59:59 +0300 Subject: [PATCH 07/43] Added all required Authentication (register/login) requests and responses Signed-off-by: Akram-Fahim --- .../users/RequestsAndResponsesTest.java | 10 ++++++++-- .../users/requests/AuthenticationRequest.java | 12 ++++++++++++ .../users/requests/ClientRegisterRequest.java | 19 +++++++++++++++++++ .../requests/FreelancerRegisterRequest.java | 12 ++++++------ .../commands/users/requests/LoginRequest.java | 13 +++++++++++++ .../responses/AuthenticationResponse.java | 13 +++++++++++++ ...Response.java => SignUpAndInResponse.java} | 4 ++-- .../commands/users/responses/UserType.java | 6 ++++++ 8 files changed, 79 insertions(+), 10 deletions(-) create mode 100644 shared/src/main/java/com/workup/shared/commands/users/requests/AuthenticationRequest.java create mode 100644 shared/src/main/java/com/workup/shared/commands/users/requests/ClientRegisterRequest.java create mode 100644 shared/src/main/java/com/workup/shared/commands/users/requests/LoginRequest.java create mode 100644 shared/src/main/java/com/workup/shared/commands/users/responses/AuthenticationResponse.java rename shared/src/main/java/com/workup/shared/commands/users/responses/{FreelancerRegisterResponse.java => SignUpAndInResponse.java} (65%) create mode 100644 shared/src/main/java/com/workup/shared/commands/users/responses/UserType.java diff --git a/services/users/src/test/java/com/workup/users/RequestsAndResponsesTest.java b/services/users/src/test/java/com/workup/users/RequestsAndResponsesTest.java index b4314d7b..1a2e6f11 100644 --- a/services/users/src/test/java/com/workup/users/RequestsAndResponsesTest.java +++ b/services/users/src/test/java/com/workup/users/RequestsAndResponsesTest.java @@ -2,8 +2,11 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; +import com.workup.shared.commands.users.requests.AuthenticationRequest; +import com.workup.shared.commands.users.requests.ClientRegisterRequest; import com.workup.shared.commands.users.requests.FreelancerRegisterRequest; -import com.workup.shared.commands.users.responses.FreelancerRegisterResponse; +import com.workup.shared.commands.users.requests.LoginRequest; +import com.workup.shared.commands.users.responses.SignUpAndInResponse; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; @@ -11,7 +14,10 @@ public class RequestsAndResponsesTest { private static Object[] testObjects = { // all requests/responses to be tested FreelancerRegisterRequest.builder().build(), - FreelancerRegisterResponse.builder().build(), + SignUpAndInResponse.builder().build(), + AuthenticationRequest.builder().build(), + ClientRegisterRequest.builder().build(), + LoginRequest.builder().build() }; @Test diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/AuthenticationRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/AuthenticationRequest.java new file mode 100644 index 00000000..d5e870bb --- /dev/null +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/AuthenticationRequest.java @@ -0,0 +1,12 @@ +package com.workup.shared.commands.users.requests; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import lombok.Builder; +import lombok.Getter; + +@Getter +@Builder(setterPrefix = "with") +@JsonDeserialize(builder = AuthenticationRequest.AuthenticationRequestBuilder.class) +public class AuthenticationRequest { + private String authToken; +} diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/ClientRegisterRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/ClientRegisterRequest.java new file mode 100644 index 00000000..9108cd8e --- /dev/null +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/ClientRegisterRequest.java @@ -0,0 +1,19 @@ +package com.workup.shared.commands.users.requests; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import lombok.Builder; +import lombok.Getter; + +@Getter +@Builder(setterPrefix = "with") +@JsonDeserialize(builder = ClientRegisterRequest.ClientRegisterRequestBuilder.class) +public class ClientRegisterRequest { + private String email; + private String passwordHash; + private String clientName; + private String industry; + private String city; + private String photoId; + private String description; + private Integer employeeCount; +} diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerRegisterRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerRegisterRequest.java index 04c2ba95..1336ec01 100644 --- a/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerRegisterRequest.java +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerRegisterRequest.java @@ -11,10 +11,10 @@ @Builder(setterPrefix = "with") @JsonDeserialize(builder = FreelancerRegisterRequest.FreelancerRegisterRequestBuilder.class) public class FreelancerRegisterRequest extends CommandRequest { - String email; - String passwordHash; - String fullName; - String jobTitle; - String city; - Date birthDate; + private String email; + private String passwordHash; + private String fullName; + private String jobTitle; + private String city; + private Date birthDate; } diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/LoginRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/LoginRequest.java new file mode 100644 index 00000000..ef1737bc --- /dev/null +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/LoginRequest.java @@ -0,0 +1,13 @@ +package com.workup.shared.commands.users.requests; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import lombok.Builder; +import lombok.Getter; + +@Getter +@Builder(setterPrefix = "with") +@JsonDeserialize(builder = LoginRequest.LoginRequestBuilder.class) +public class LoginRequest { + private String email; + private String passwordHash; +} diff --git a/shared/src/main/java/com/workup/shared/commands/users/responses/AuthenticationResponse.java b/shared/src/main/java/com/workup/shared/commands/users/responses/AuthenticationResponse.java new file mode 100644 index 00000000..68bf5db4 --- /dev/null +++ b/shared/src/main/java/com/workup/shared/commands/users/responses/AuthenticationResponse.java @@ -0,0 +1,13 @@ +package com.workup.shared.commands.users.responses; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import lombok.Builder; +import lombok.Getter; + +@Getter +@Builder(setterPrefix = "with") +@JsonDeserialize(builder = AuthenticationResponse.AuthenticationResponseBuilder.class) +public class AuthenticationResponse { + private String email; + private UserType userType; +} diff --git a/shared/src/main/java/com/workup/shared/commands/users/responses/FreelancerRegisterResponse.java b/shared/src/main/java/com/workup/shared/commands/users/responses/SignUpAndInResponse.java similarity index 65% rename from shared/src/main/java/com/workup/shared/commands/users/responses/FreelancerRegisterResponse.java rename to shared/src/main/java/com/workup/shared/commands/users/responses/SignUpAndInResponse.java index 408680df..4d0c736c 100644 --- a/shared/src/main/java/com/workup/shared/commands/users/responses/FreelancerRegisterResponse.java +++ b/shared/src/main/java/com/workup/shared/commands/users/responses/SignUpAndInResponse.java @@ -7,8 +7,8 @@ @Getter @Builder(setterPrefix = "with") -@JsonDeserialize(builder = FreelancerRegisterResponse.FreelancerRegisterResponseBuilder.class) -public class FreelancerRegisterResponse extends CommandResponse { +@JsonDeserialize(builder = SignUpAndInResponse.SignUpAndInResponseBuilder.class) +public class SignUpAndInResponse extends CommandResponse { boolean success; String authToken; } diff --git a/shared/src/main/java/com/workup/shared/commands/users/responses/UserType.java b/shared/src/main/java/com/workup/shared/commands/users/responses/UserType.java new file mode 100644 index 00000000..2b68d577 --- /dev/null +++ b/shared/src/main/java/com/workup/shared/commands/users/responses/UserType.java @@ -0,0 +1,6 @@ +package com.workup.shared.commands.users.responses; + +public enum UserType { + FREELANCER, + CLIENT +} From dbdc281971cf2204fcd1f76ef274ea26679744da Mon Sep 17 00:00:00 2001 From: Akram-Fahim Date: Sun, 28 Apr 2024 21:03:50 +0300 Subject: [PATCH 08/43] Deleted useless file Signed-off-by: Akram-Fahim --- .../commands/users/requests/FreelancerLoginRequest.java | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java deleted file mode 100644 index b278398d..00000000 --- a/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java +++ /dev/null @@ -1,9 +0,0 @@ -//package com.workup.users.requests; -// -//public class FreelancerLoginRequest { -// String email = ""; -// -// @NonNull -// @Builder.Default -// String passwordHash = ""; -//} From 1ab58d2ccc3f9725de514aec4954f5705ddab58d Mon Sep 17 00:00:00 2001 From: Akram-Fahim Date: Mon, 4 Mar 2024 11:52:54 +0200 Subject: [PATCH 09/43] Created Users module, and added FreelancerRegister request and response --- .../requests/FreelancerRegisterRequest.java | 16 ++++++++++++++++ .../responses/FreelancerRegisterResponse.java | 9 +++++++++ 2 files changed, 25 insertions(+) create mode 100644 services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java create mode 100644 services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java diff --git a/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java b/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java new file mode 100644 index 00000000..b33c01d8 --- /dev/null +++ b/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java @@ -0,0 +1,16 @@ +package com.workup.users.requests; +import com.workup.shared.commands.CommandRequest; +import lombok.Builder; +import lombok.NonNull; + +import java.util.Date; + +@Builder +public class FreelancerRegisterRequest extends CommandRequest { + @NonNull String email; + @NonNull String passwordHash; + @NonNull String fullName; + String jobTitle; + String city; + Date birthDate; +} diff --git a/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java b/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java new file mode 100644 index 00000000..68c4d81e --- /dev/null +++ b/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java @@ -0,0 +1,9 @@ +package com.workup.users.responses; + +import com.workup.shared.commands.CommandResponse; +import lombok.NonNull; + +public class FreelancerRegisterResponse extends CommandResponse { + @NonNull boolean success; + String authToken; +} From 22abc27f09f6ff60047b6bebbb18d2247bb8effe Mon Sep 17 00:00:00 2001 From: Akram-Fahim Date: Mon, 4 Mar 2024 12:43:14 +0200 Subject: [PATCH 10/43] Updated added builder annotation to FreelancerRegisterResponse and removed redundant @NonNull --- .../workup/users/responses/FreelancerRegisterResponse.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java b/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java index 68c4d81e..0a4c4dca 100644 --- a/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java +++ b/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java @@ -1,9 +1,10 @@ package com.workup.users.responses; import com.workup.shared.commands.CommandResponse; -import lombok.NonNull; +import lombok.Builder; +@Builder public class FreelancerRegisterResponse extends CommandResponse { - @NonNull boolean success; + boolean success; String authToken; } From fafeb94422b62fbd8acc09ee6e538dadceb8a780 Mon Sep 17 00:00:00 2001 From: Akram-Fahim Date: Mon, 4 Mar 2024 13:07:02 +0200 Subject: [PATCH 11/43] Removed the NonNull annotation to make the class compatible with the Builder annotation --- .../workup/users/requests/FreelancerRegisterRequest.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java b/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java index b33c01d8..551ecfe2 100644 --- a/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java +++ b/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java @@ -1,15 +1,14 @@ package com.workup.users.requests; import com.workup.shared.commands.CommandRequest; import lombok.Builder; -import lombok.NonNull; import java.util.Date; @Builder public class FreelancerRegisterRequest extends CommandRequest { - @NonNull String email; - @NonNull String passwordHash; - @NonNull String fullName; + String email; + String passwordHash; + String fullName; String jobTitle; String city; Date birthDate; From a32128ece98cdac90c36a7e3b0aae1d21d8959e2 Mon Sep 17 00:00:00 2001 From: Akram-Fahim Date: Mon, 4 Mar 2024 15:08:48 +0200 Subject: [PATCH 12/43] Addressed @Ahmad45123's comments and created a test to verify the serialization process. --- .../users/requests/FreelancerRegisterRequest.java | 15 --------------- .../responses/FreelancerRegisterResponse.java | 10 ---------- .../users/requests/FreelancerLoginRequest.java | 9 +++++++++ 3 files changed, 9 insertions(+), 25 deletions(-) delete mode 100644 services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java delete mode 100644 services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java create mode 100644 shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java diff --git a/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java b/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java deleted file mode 100644 index 551ecfe2..00000000 --- a/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.workup.users.requests; -import com.workup.shared.commands.CommandRequest; -import lombok.Builder; - -import java.util.Date; - -@Builder -public class FreelancerRegisterRequest extends CommandRequest { - String email; - String passwordHash; - String fullName; - String jobTitle; - String city; - Date birthDate; -} diff --git a/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java b/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java deleted file mode 100644 index 0a4c4dca..00000000 --- a/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.workup.users.responses; - -import com.workup.shared.commands.CommandResponse; -import lombok.Builder; - -@Builder -public class FreelancerRegisterResponse extends CommandResponse { - boolean success; - String authToken; -} diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java new file mode 100644 index 00000000..b278398d --- /dev/null +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java @@ -0,0 +1,9 @@ +//package com.workup.users.requests; +// +//public class FreelancerLoginRequest { +// String email = ""; +// +// @NonNull +// @Builder.Default +// String passwordHash = ""; +//} From 0ce0bca1dcf17798a195b7d744f6caf92eff314e Mon Sep 17 00:00:00 2001 From: Akram-Fahim Date: Fri, 8 Mar 2024 22:39:44 +0200 Subject: [PATCH 13/43] Deleted commented file Signed-off-by: Akram-Fahim --- .../commands/users/requests/FreelancerLoginRequest.java | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java deleted file mode 100644 index b278398d..00000000 --- a/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java +++ /dev/null @@ -1,9 +0,0 @@ -//package com.workup.users.requests; -// -//public class FreelancerLoginRequest { -// String email = ""; -// -// @NonNull -// @Builder.Default -// String passwordHash = ""; -//} From 7621e89c8ab57644fc7b13fde256d0f9b02f3bee Mon Sep 17 00:00:00 2001 From: Akram-Fahim Date: Fri, 8 Mar 2024 22:41:14 +0200 Subject: [PATCH 14/43] Revert "Deleted commented file" This reverts commit f9b11cf2487813bd69bb8f2fe0ffab8a848ea00a. --- .../commands/users/requests/FreelancerLoginRequest.java | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java new file mode 100644 index 00000000..b278398d --- /dev/null +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java @@ -0,0 +1,9 @@ +//package com.workup.users.requests; +// +//public class FreelancerLoginRequest { +// String email = ""; +// +// @NonNull +// @Builder.Default +// String passwordHash = ""; +//} From d14d33b34cf06cbd7e9c8bc32ebfac39ae1da5a1 Mon Sep 17 00:00:00 2001 From: Akram-Fahim Date: Sun, 28 Apr 2024 20:59:59 +0300 Subject: [PATCH 15/43] Added all required Authentication (register/login) requests and responses Signed-off-by: Akram-Fahim --- .../users/RequestsAndResponsesTest.java | 47 +++++++++++-------- .../users/requests/AuthenticationRequest.java | 12 +++++ .../users/requests/ClientRegisterRequest.java | 19 ++++++++ .../requests/FreelancerRegisterRequest.java | 24 +++++----- .../commands/users/requests/LoginRequest.java | 13 +++++ .../responses/AuthenticationResponse.java | 13 +++++ .../responses/FreelancerRegisterResponse.java | 15 ------ .../users/responses/SignUpAndInResponse.java | 14 ++++++ .../commands/users/responses/UserType.java | 6 +++ 9 files changed, 117 insertions(+), 46 deletions(-) create mode 100644 shared/src/main/java/com/workup/shared/commands/users/requests/AuthenticationRequest.java create mode 100644 shared/src/main/java/com/workup/shared/commands/users/requests/ClientRegisterRequest.java create mode 100644 shared/src/main/java/com/workup/shared/commands/users/requests/LoginRequest.java create mode 100644 shared/src/main/java/com/workup/shared/commands/users/responses/AuthenticationResponse.java delete mode 100644 shared/src/main/java/com/workup/shared/commands/users/responses/FreelancerRegisterResponse.java create mode 100644 shared/src/main/java/com/workup/shared/commands/users/responses/SignUpAndInResponse.java create mode 100644 shared/src/main/java/com/workup/shared/commands/users/responses/UserType.java diff --git a/services/users/src/test/java/com/workup/users/RequestsAndResponsesTest.java b/services/users/src/test/java/com/workup/users/RequestsAndResponsesTest.java index f005e3a8..1a2e6f11 100644 --- a/services/users/src/test/java/com/workup/users/RequestsAndResponsesTest.java +++ b/services/users/src/test/java/com/workup/users/RequestsAndResponsesTest.java @@ -1,30 +1,39 @@ package com.workup.users; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; - import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; +import com.workup.shared.commands.users.requests.AuthenticationRequest; +import com.workup.shared.commands.users.requests.ClientRegisterRequest; import com.workup.shared.commands.users.requests.FreelancerRegisterRequest; -import com.workup.shared.commands.users.responses.FreelancerRegisterResponse; +import com.workup.shared.commands.users.requests.LoginRequest; +import com.workup.shared.commands.users.responses.SignUpAndInResponse; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; + public class RequestsAndResponsesTest { - private static Object[] testObjects = { // all requests/responses to be tested - FreelancerRegisterRequest.builder().build(), FreelancerRegisterResponse.builder().build(), - }; + private static Object[] testObjects = { // all requests/responses to be tested + FreelancerRegisterRequest.builder().build(), + SignUpAndInResponse.builder().build(), + AuthenticationRequest.builder().build(), + ClientRegisterRequest.builder().build(), + LoginRequest.builder().build() + }; - @Test - public void testSerializationNoExceptionsThrown() throws JsonProcessingException { - ObjectMapper objectMapper = new ObjectMapper(); - for (Object testObject : testObjects) { - String className = testObject.getClass().getName(); - assertDoesNotThrow( - () -> objectMapper.writeValueAsString(testObject), - String.format("Serialization of %s should not throw exceptions", className)); - String json = objectMapper.writeValueAsString(testObject); - assertDoesNotThrow( - () -> objectMapper.readValue(json, testObject.getClass()), - String.format("Deserialization of %s should not throw exceptions", className)); + @Test + public void testSerializationNoExceptionsThrown() throws JsonProcessingException { + ObjectMapper objectMapper = new ObjectMapper(); + for (Object testObject : testObjects) { + String className = testObject.getClass().getName(); + assertDoesNotThrow( + () -> objectMapper.writeValueAsString(testObject), + String.format("Serialization of %s should not throw exceptions", className) + ); + String json = objectMapper.writeValueAsString(testObject); + assertDoesNotThrow( + () -> objectMapper.readValue(json, testObject.getClass()), + String.format("Deserialization of %s should not throw exceptions", className) + ); + } } - } } diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/AuthenticationRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/AuthenticationRequest.java new file mode 100644 index 00000000..d5e870bb --- /dev/null +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/AuthenticationRequest.java @@ -0,0 +1,12 @@ +package com.workup.shared.commands.users.requests; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import lombok.Builder; +import lombok.Getter; + +@Getter +@Builder(setterPrefix = "with") +@JsonDeserialize(builder = AuthenticationRequest.AuthenticationRequestBuilder.class) +public class AuthenticationRequest { + private String authToken; +} diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/ClientRegisterRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/ClientRegisterRequest.java new file mode 100644 index 00000000..9108cd8e --- /dev/null +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/ClientRegisterRequest.java @@ -0,0 +1,19 @@ +package com.workup.shared.commands.users.requests; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import lombok.Builder; +import lombok.Getter; + +@Getter +@Builder(setterPrefix = "with") +@JsonDeserialize(builder = ClientRegisterRequest.ClientRegisterRequestBuilder.class) +public class ClientRegisterRequest { + private String email; + private String passwordHash; + private String clientName; + private String industry; + private String city; + private String photoId; + private String description; + private Integer employeeCount; +} diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerRegisterRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerRegisterRequest.java index e2e80b63..1336ec01 100644 --- a/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerRegisterRequest.java +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerRegisterRequest.java @@ -1,20 +1,20 @@ package com.workup.shared.commands.users.requests; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.workup.shared.commands.CommandRequest; -import java.util.Date; +import lombok.Builder; import lombok.Getter; -import lombok.experimental.SuperBuilder; -import lombok.extern.jackson.Jacksonized; + +import java.util.Date; @Getter -@SuperBuilder(setterPrefix = "with") -@Jacksonized +@Builder(setterPrefix = "with") +@JsonDeserialize(builder = FreelancerRegisterRequest.FreelancerRegisterRequestBuilder.class) public class FreelancerRegisterRequest extends CommandRequest { - - String email; - String passwordHash; - String fullName; - String jobTitle; - String city; - Date birthDate; + private String email; + private String passwordHash; + private String fullName; + private String jobTitle; + private String city; + private Date birthDate; } diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/LoginRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/LoginRequest.java new file mode 100644 index 00000000..ef1737bc --- /dev/null +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/LoginRequest.java @@ -0,0 +1,13 @@ +package com.workup.shared.commands.users.requests; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import lombok.Builder; +import lombok.Getter; + +@Getter +@Builder(setterPrefix = "with") +@JsonDeserialize(builder = LoginRequest.LoginRequestBuilder.class) +public class LoginRequest { + private String email; + private String passwordHash; +} diff --git a/shared/src/main/java/com/workup/shared/commands/users/responses/AuthenticationResponse.java b/shared/src/main/java/com/workup/shared/commands/users/responses/AuthenticationResponse.java new file mode 100644 index 00000000..68bf5db4 --- /dev/null +++ b/shared/src/main/java/com/workup/shared/commands/users/responses/AuthenticationResponse.java @@ -0,0 +1,13 @@ +package com.workup.shared.commands.users.responses; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import lombok.Builder; +import lombok.Getter; + +@Getter +@Builder(setterPrefix = "with") +@JsonDeserialize(builder = AuthenticationResponse.AuthenticationResponseBuilder.class) +public class AuthenticationResponse { + private String email; + private UserType userType; +} diff --git a/shared/src/main/java/com/workup/shared/commands/users/responses/FreelancerRegisterResponse.java b/shared/src/main/java/com/workup/shared/commands/users/responses/FreelancerRegisterResponse.java deleted file mode 100644 index 16266af1..00000000 --- a/shared/src/main/java/com/workup/shared/commands/users/responses/FreelancerRegisterResponse.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.workup.shared.commands.users.responses; - -import com.workup.shared.commands.CommandResponse; -import lombok.Getter; -import lombok.experimental.SuperBuilder; -import lombok.extern.jackson.Jacksonized; - -@Getter -@SuperBuilder(setterPrefix = "with") -@Jacksonized -public class FreelancerRegisterResponse extends CommandResponse { - - boolean success; - String authToken; -} diff --git a/shared/src/main/java/com/workup/shared/commands/users/responses/SignUpAndInResponse.java b/shared/src/main/java/com/workup/shared/commands/users/responses/SignUpAndInResponse.java new file mode 100644 index 00000000..4d0c736c --- /dev/null +++ b/shared/src/main/java/com/workup/shared/commands/users/responses/SignUpAndInResponse.java @@ -0,0 +1,14 @@ +package com.workup.shared.commands.users.responses; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.workup.shared.commands.CommandResponse; +import lombok.Builder; +import lombok.Getter; + +@Getter +@Builder(setterPrefix = "with") +@JsonDeserialize(builder = SignUpAndInResponse.SignUpAndInResponseBuilder.class) +public class SignUpAndInResponse extends CommandResponse { + boolean success; + String authToken; +} diff --git a/shared/src/main/java/com/workup/shared/commands/users/responses/UserType.java b/shared/src/main/java/com/workup/shared/commands/users/responses/UserType.java new file mode 100644 index 00000000..2b68d577 --- /dev/null +++ b/shared/src/main/java/com/workup/shared/commands/users/responses/UserType.java @@ -0,0 +1,6 @@ +package com.workup.shared.commands.users.responses; + +public enum UserType { + FREELANCER, + CLIENT +} From 208bf61e777fef447f7a4cc65f830cb3bf4a7325 Mon Sep 17 00:00:00 2001 From: Akram-Fahim Date: Sun, 28 Apr 2024 21:03:50 +0300 Subject: [PATCH 16/43] Deleted useless file Signed-off-by: Akram-Fahim --- .../commands/users/requests/FreelancerLoginRequest.java | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java deleted file mode 100644 index b278398d..00000000 --- a/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java +++ /dev/null @@ -1,9 +0,0 @@ -//package com.workup.users.requests; -// -//public class FreelancerLoginRequest { -// String email = ""; -// -// @NonNull -// @Builder.Default -// String passwordHash = ""; -//} From 6438cd377ada6904db9270bab54a9721ce2d456c Mon Sep 17 00:00:00 2001 From: Akram-Fahim Date: Mon, 4 Mar 2024 11:52:54 +0200 Subject: [PATCH 17/43] Created Users module, and added FreelancerRegister request and response --- .../requests/FreelancerRegisterRequest.java | 16 ++++++++++++++++ .../responses/FreelancerRegisterResponse.java | 9 +++++++++ 2 files changed, 25 insertions(+) create mode 100644 services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java create mode 100644 services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java diff --git a/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java b/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java new file mode 100644 index 00000000..b33c01d8 --- /dev/null +++ b/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java @@ -0,0 +1,16 @@ +package com.workup.users.requests; +import com.workup.shared.commands.CommandRequest; +import lombok.Builder; +import lombok.NonNull; + +import java.util.Date; + +@Builder +public class FreelancerRegisterRequest extends CommandRequest { + @NonNull String email; + @NonNull String passwordHash; + @NonNull String fullName; + String jobTitle; + String city; + Date birthDate; +} diff --git a/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java b/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java new file mode 100644 index 00000000..68c4d81e --- /dev/null +++ b/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java @@ -0,0 +1,9 @@ +package com.workup.users.responses; + +import com.workup.shared.commands.CommandResponse; +import lombok.NonNull; + +public class FreelancerRegisterResponse extends CommandResponse { + @NonNull boolean success; + String authToken; +} From 143521a71cd5113af7b1819b9f38d91968a321f8 Mon Sep 17 00:00:00 2001 From: Akram-Fahim Date: Mon, 4 Mar 2024 12:43:14 +0200 Subject: [PATCH 18/43] Updated added builder annotation to FreelancerRegisterResponse and removed redundant @NonNull --- .../workup/users/responses/FreelancerRegisterResponse.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java b/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java index 68c4d81e..0a4c4dca 100644 --- a/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java +++ b/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java @@ -1,9 +1,10 @@ package com.workup.users.responses; import com.workup.shared.commands.CommandResponse; -import lombok.NonNull; +import lombok.Builder; +@Builder public class FreelancerRegisterResponse extends CommandResponse { - @NonNull boolean success; + boolean success; String authToken; } From dfce4d7d8c4aec19fdad36427a4ec382d663e8c4 Mon Sep 17 00:00:00 2001 From: Akram-Fahim Date: Mon, 4 Mar 2024 13:07:02 +0200 Subject: [PATCH 19/43] Removed the NonNull annotation to make the class compatible with the Builder annotation --- .../workup/users/requests/FreelancerRegisterRequest.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java b/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java index b33c01d8..551ecfe2 100644 --- a/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java +++ b/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java @@ -1,15 +1,14 @@ package com.workup.users.requests; import com.workup.shared.commands.CommandRequest; import lombok.Builder; -import lombok.NonNull; import java.util.Date; @Builder public class FreelancerRegisterRequest extends CommandRequest { - @NonNull String email; - @NonNull String passwordHash; - @NonNull String fullName; + String email; + String passwordHash; + String fullName; String jobTitle; String city; Date birthDate; From d0b79d7329f4a6f39a518c988f7f6a024b14104f Mon Sep 17 00:00:00 2001 From: Akram-Fahim Date: Mon, 4 Mar 2024 15:08:48 +0200 Subject: [PATCH 20/43] Addressed @Ahmad45123's comments and created a test to verify the serialization process. --- .../users/requests/FreelancerRegisterRequest.java | 15 --------------- .../responses/FreelancerRegisterResponse.java | 10 ---------- 2 files changed, 25 deletions(-) delete mode 100644 services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java delete mode 100644 services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java diff --git a/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java b/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java deleted file mode 100644 index 551ecfe2..00000000 --- a/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.workup.users.requests; -import com.workup.shared.commands.CommandRequest; -import lombok.Builder; - -import java.util.Date; - -@Builder -public class FreelancerRegisterRequest extends CommandRequest { - String email; - String passwordHash; - String fullName; - String jobTitle; - String city; - Date birthDate; -} diff --git a/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java b/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java deleted file mode 100644 index 0a4c4dca..00000000 --- a/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.workup.users.responses; - -import com.workup.shared.commands.CommandResponse; -import lombok.Builder; - -@Builder -public class FreelancerRegisterResponse extends CommandResponse { - boolean success; - String authToken; -} From 1e8dd538d3e8a7bfe164125516b118326ff92c8c Mon Sep 17 00:00:00 2001 From: Akram-Fahim Date: Fri, 8 Mar 2024 22:39:44 +0200 Subject: [PATCH 21/43] Deleted commented file Signed-off-by: Akram-Fahim --- .../commands/users/requests/FreelancerLoginRequest.java | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java deleted file mode 100644 index b278398d..00000000 --- a/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java +++ /dev/null @@ -1,9 +0,0 @@ -//package com.workup.users.requests; -// -//public class FreelancerLoginRequest { -// String email = ""; -// -// @NonNull -// @Builder.Default -// String passwordHash = ""; -//} From de0f05fe55fc6d7b64f796c86ed5820707b202d5 Mon Sep 17 00:00:00 2001 From: Akram-Fahim Date: Fri, 8 Mar 2024 22:41:14 +0200 Subject: [PATCH 22/43] Revert "Deleted commented file" This reverts commit f9b11cf2487813bd69bb8f2fe0ffab8a848ea00a. --- .../commands/users/requests/FreelancerLoginRequest.java | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java new file mode 100644 index 00000000..b278398d --- /dev/null +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java @@ -0,0 +1,9 @@ +//package com.workup.users.requests; +// +//public class FreelancerLoginRequest { +// String email = ""; +// +// @NonNull +// @Builder.Default +// String passwordHash = ""; +//} From 7fbc77de5bcfc967da1ee8b04973482bb63e19cf Mon Sep 17 00:00:00 2001 From: Akram-Fahim Date: Sun, 28 Apr 2024 20:59:59 +0300 Subject: [PATCH 23/43] Added all required Authentication (register/login) requests and responses Signed-off-by: Akram-Fahim --- .../users/RequestsAndResponsesTest.java | 47 +++++++++++-------- .../users/requests/AuthenticationRequest.java | 12 +++++ .../users/requests/ClientRegisterRequest.java | 19 ++++++++ .../requests/FreelancerRegisterRequest.java | 24 +++++----- .../commands/users/requests/LoginRequest.java | 13 +++++ .../responses/AuthenticationResponse.java | 13 +++++ .../responses/FreelancerRegisterResponse.java | 15 ------ .../users/responses/SignUpAndInResponse.java | 14 ++++++ .../commands/users/responses/UserType.java | 6 +++ 9 files changed, 117 insertions(+), 46 deletions(-) create mode 100644 shared/src/main/java/com/workup/shared/commands/users/requests/AuthenticationRequest.java create mode 100644 shared/src/main/java/com/workup/shared/commands/users/requests/ClientRegisterRequest.java create mode 100644 shared/src/main/java/com/workup/shared/commands/users/requests/LoginRequest.java create mode 100644 shared/src/main/java/com/workup/shared/commands/users/responses/AuthenticationResponse.java delete mode 100644 shared/src/main/java/com/workup/shared/commands/users/responses/FreelancerRegisterResponse.java create mode 100644 shared/src/main/java/com/workup/shared/commands/users/responses/SignUpAndInResponse.java create mode 100644 shared/src/main/java/com/workup/shared/commands/users/responses/UserType.java diff --git a/services/users/src/test/java/com/workup/users/RequestsAndResponsesTest.java b/services/users/src/test/java/com/workup/users/RequestsAndResponsesTest.java index f005e3a8..1a2e6f11 100644 --- a/services/users/src/test/java/com/workup/users/RequestsAndResponsesTest.java +++ b/services/users/src/test/java/com/workup/users/RequestsAndResponsesTest.java @@ -1,30 +1,39 @@ package com.workup.users; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; - import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; +import com.workup.shared.commands.users.requests.AuthenticationRequest; +import com.workup.shared.commands.users.requests.ClientRegisterRequest; import com.workup.shared.commands.users.requests.FreelancerRegisterRequest; -import com.workup.shared.commands.users.responses.FreelancerRegisterResponse; +import com.workup.shared.commands.users.requests.LoginRequest; +import com.workup.shared.commands.users.responses.SignUpAndInResponse; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; + public class RequestsAndResponsesTest { - private static Object[] testObjects = { // all requests/responses to be tested - FreelancerRegisterRequest.builder().build(), FreelancerRegisterResponse.builder().build(), - }; + private static Object[] testObjects = { // all requests/responses to be tested + FreelancerRegisterRequest.builder().build(), + SignUpAndInResponse.builder().build(), + AuthenticationRequest.builder().build(), + ClientRegisterRequest.builder().build(), + LoginRequest.builder().build() + }; - @Test - public void testSerializationNoExceptionsThrown() throws JsonProcessingException { - ObjectMapper objectMapper = new ObjectMapper(); - for (Object testObject : testObjects) { - String className = testObject.getClass().getName(); - assertDoesNotThrow( - () -> objectMapper.writeValueAsString(testObject), - String.format("Serialization of %s should not throw exceptions", className)); - String json = objectMapper.writeValueAsString(testObject); - assertDoesNotThrow( - () -> objectMapper.readValue(json, testObject.getClass()), - String.format("Deserialization of %s should not throw exceptions", className)); + @Test + public void testSerializationNoExceptionsThrown() throws JsonProcessingException { + ObjectMapper objectMapper = new ObjectMapper(); + for (Object testObject : testObjects) { + String className = testObject.getClass().getName(); + assertDoesNotThrow( + () -> objectMapper.writeValueAsString(testObject), + String.format("Serialization of %s should not throw exceptions", className) + ); + String json = objectMapper.writeValueAsString(testObject); + assertDoesNotThrow( + () -> objectMapper.readValue(json, testObject.getClass()), + String.format("Deserialization of %s should not throw exceptions", className) + ); + } } - } } diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/AuthenticationRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/AuthenticationRequest.java new file mode 100644 index 00000000..d5e870bb --- /dev/null +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/AuthenticationRequest.java @@ -0,0 +1,12 @@ +package com.workup.shared.commands.users.requests; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import lombok.Builder; +import lombok.Getter; + +@Getter +@Builder(setterPrefix = "with") +@JsonDeserialize(builder = AuthenticationRequest.AuthenticationRequestBuilder.class) +public class AuthenticationRequest { + private String authToken; +} diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/ClientRegisterRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/ClientRegisterRequest.java new file mode 100644 index 00000000..9108cd8e --- /dev/null +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/ClientRegisterRequest.java @@ -0,0 +1,19 @@ +package com.workup.shared.commands.users.requests; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import lombok.Builder; +import lombok.Getter; + +@Getter +@Builder(setterPrefix = "with") +@JsonDeserialize(builder = ClientRegisterRequest.ClientRegisterRequestBuilder.class) +public class ClientRegisterRequest { + private String email; + private String passwordHash; + private String clientName; + private String industry; + private String city; + private String photoId; + private String description; + private Integer employeeCount; +} diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerRegisterRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerRegisterRequest.java index e2e80b63..1336ec01 100644 --- a/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerRegisterRequest.java +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerRegisterRequest.java @@ -1,20 +1,20 @@ package com.workup.shared.commands.users.requests; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.workup.shared.commands.CommandRequest; -import java.util.Date; +import lombok.Builder; import lombok.Getter; -import lombok.experimental.SuperBuilder; -import lombok.extern.jackson.Jacksonized; + +import java.util.Date; @Getter -@SuperBuilder(setterPrefix = "with") -@Jacksonized +@Builder(setterPrefix = "with") +@JsonDeserialize(builder = FreelancerRegisterRequest.FreelancerRegisterRequestBuilder.class) public class FreelancerRegisterRequest extends CommandRequest { - - String email; - String passwordHash; - String fullName; - String jobTitle; - String city; - Date birthDate; + private String email; + private String passwordHash; + private String fullName; + private String jobTitle; + private String city; + private Date birthDate; } diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/LoginRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/LoginRequest.java new file mode 100644 index 00000000..ef1737bc --- /dev/null +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/LoginRequest.java @@ -0,0 +1,13 @@ +package com.workup.shared.commands.users.requests; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import lombok.Builder; +import lombok.Getter; + +@Getter +@Builder(setterPrefix = "with") +@JsonDeserialize(builder = LoginRequest.LoginRequestBuilder.class) +public class LoginRequest { + private String email; + private String passwordHash; +} diff --git a/shared/src/main/java/com/workup/shared/commands/users/responses/AuthenticationResponse.java b/shared/src/main/java/com/workup/shared/commands/users/responses/AuthenticationResponse.java new file mode 100644 index 00000000..68bf5db4 --- /dev/null +++ b/shared/src/main/java/com/workup/shared/commands/users/responses/AuthenticationResponse.java @@ -0,0 +1,13 @@ +package com.workup.shared.commands.users.responses; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import lombok.Builder; +import lombok.Getter; + +@Getter +@Builder(setterPrefix = "with") +@JsonDeserialize(builder = AuthenticationResponse.AuthenticationResponseBuilder.class) +public class AuthenticationResponse { + private String email; + private UserType userType; +} diff --git a/shared/src/main/java/com/workup/shared/commands/users/responses/FreelancerRegisterResponse.java b/shared/src/main/java/com/workup/shared/commands/users/responses/FreelancerRegisterResponse.java deleted file mode 100644 index 16266af1..00000000 --- a/shared/src/main/java/com/workup/shared/commands/users/responses/FreelancerRegisterResponse.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.workup.shared.commands.users.responses; - -import com.workup.shared.commands.CommandResponse; -import lombok.Getter; -import lombok.experimental.SuperBuilder; -import lombok.extern.jackson.Jacksonized; - -@Getter -@SuperBuilder(setterPrefix = "with") -@Jacksonized -public class FreelancerRegisterResponse extends CommandResponse { - - boolean success; - String authToken; -} diff --git a/shared/src/main/java/com/workup/shared/commands/users/responses/SignUpAndInResponse.java b/shared/src/main/java/com/workup/shared/commands/users/responses/SignUpAndInResponse.java new file mode 100644 index 00000000..4d0c736c --- /dev/null +++ b/shared/src/main/java/com/workup/shared/commands/users/responses/SignUpAndInResponse.java @@ -0,0 +1,14 @@ +package com.workup.shared.commands.users.responses; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.workup.shared.commands.CommandResponse; +import lombok.Builder; +import lombok.Getter; + +@Getter +@Builder(setterPrefix = "with") +@JsonDeserialize(builder = SignUpAndInResponse.SignUpAndInResponseBuilder.class) +public class SignUpAndInResponse extends CommandResponse { + boolean success; + String authToken; +} diff --git a/shared/src/main/java/com/workup/shared/commands/users/responses/UserType.java b/shared/src/main/java/com/workup/shared/commands/users/responses/UserType.java new file mode 100644 index 00000000..2b68d577 --- /dev/null +++ b/shared/src/main/java/com/workup/shared/commands/users/responses/UserType.java @@ -0,0 +1,6 @@ +package com.workup.shared.commands.users.responses; + +public enum UserType { + FREELANCER, + CLIENT +} From 006288ca3fdd9df815ceb443b72ed5fef835834a Mon Sep 17 00:00:00 2001 From: Akram-Fahim Date: Sun, 28 Apr 2024 21:03:50 +0300 Subject: [PATCH 24/43] Deleted useless file Signed-off-by: Akram-Fahim --- .../commands/users/requests/FreelancerLoginRequest.java | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java deleted file mode 100644 index b278398d..00000000 --- a/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java +++ /dev/null @@ -1,9 +0,0 @@ -//package com.workup.users.requests; -// -//public class FreelancerLoginRequest { -// String email = ""; -// -// @NonNull -// @Builder.Default -// String passwordHash = ""; -//} From 3d2ab3b61ca6fe42e8abec1d9c08a2423c1b71f4 Mon Sep 17 00:00:00 2001 From: Akram-Fahim Date: Sun, 28 Apr 2024 21:29:40 +0300 Subject: [PATCH 25/43] Updated the annotations to match the ones requested by @Ahmad45123 Signed-off-by: Akram-Fahim --- .../users/requests/AuthenticationRequest.java | 10 ++++---- .../users/requests/ClientRegisterRequest.java | 24 +++++++++---------- .../requests/FreelancerRegisterRequest.java | 23 +++++++++--------- .../commands/users/requests/LoginRequest.java | 12 +++++----- .../responses/AuthenticationResponse.java | 12 +++++----- .../users/responses/SignUpAndInResponse.java | 12 +++++----- 6 files changed, 46 insertions(+), 47 deletions(-) diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/AuthenticationRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/AuthenticationRequest.java index d5e870bb..9b759355 100644 --- a/shared/src/main/java/com/workup/shared/commands/users/requests/AuthenticationRequest.java +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/AuthenticationRequest.java @@ -1,12 +1,12 @@ package com.workup.shared.commands.users.requests; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import lombok.Builder; import lombok.Getter; +import lombok.experimental.SuperBuilder; +import lombok.extern.jackson.Jacksonized; @Getter -@Builder(setterPrefix = "with") -@JsonDeserialize(builder = AuthenticationRequest.AuthenticationRequestBuilder.class) +@SuperBuilder(setterPrefix = "with") +@Jacksonized public class AuthenticationRequest { - private String authToken; + private String authToken; } diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/ClientRegisterRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/ClientRegisterRequest.java index 9108cd8e..42260a36 100644 --- a/shared/src/main/java/com/workup/shared/commands/users/requests/ClientRegisterRequest.java +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/ClientRegisterRequest.java @@ -1,19 +1,19 @@ package com.workup.shared.commands.users.requests; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import lombok.Builder; import lombok.Getter; +import lombok.experimental.SuperBuilder; +import lombok.extern.jackson.Jacksonized; @Getter -@Builder(setterPrefix = "with") -@JsonDeserialize(builder = ClientRegisterRequest.ClientRegisterRequestBuilder.class) +@SuperBuilder(setterPrefix = "with") +@Jacksonized public class ClientRegisterRequest { - private String email; - private String passwordHash; - private String clientName; - private String industry; - private String city; - private String photoId; - private String description; - private Integer employeeCount; + private String email; + private String passwordHash; + private String clientName; + private String industry; + private String city; + private String photoId; + private String description; + private Integer employeeCount; } diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerRegisterRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerRegisterRequest.java index 1336ec01..6f2875ac 100644 --- a/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerRegisterRequest.java +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerRegisterRequest.java @@ -1,20 +1,19 @@ package com.workup.shared.commands.users.requests; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.workup.shared.commands.CommandRequest; -import lombok.Builder; -import lombok.Getter; - import java.util.Date; +import lombok.Getter; +import lombok.experimental.SuperBuilder; +import lombok.extern.jackson.Jacksonized; @Getter -@Builder(setterPrefix = "with") -@JsonDeserialize(builder = FreelancerRegisterRequest.FreelancerRegisterRequestBuilder.class) +@SuperBuilder(setterPrefix = "with") +@Jacksonized public class FreelancerRegisterRequest extends CommandRequest { - private String email; - private String passwordHash; - private String fullName; - private String jobTitle; - private String city; - private Date birthDate; + private String email; + private String passwordHash; + private String fullName; + private String jobTitle; + private String city; + private Date birthDate; } diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/LoginRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/LoginRequest.java index ef1737bc..c89d10c1 100644 --- a/shared/src/main/java/com/workup/shared/commands/users/requests/LoginRequest.java +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/LoginRequest.java @@ -1,13 +1,13 @@ package com.workup.shared.commands.users.requests; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import lombok.Builder; import lombok.Getter; +import lombok.experimental.SuperBuilder; +import lombok.extern.jackson.Jacksonized; @Getter -@Builder(setterPrefix = "with") -@JsonDeserialize(builder = LoginRequest.LoginRequestBuilder.class) +@SuperBuilder(setterPrefix = "with") +@Jacksonized public class LoginRequest { - private String email; - private String passwordHash; + private String email; + private String passwordHash; } diff --git a/shared/src/main/java/com/workup/shared/commands/users/responses/AuthenticationResponse.java b/shared/src/main/java/com/workup/shared/commands/users/responses/AuthenticationResponse.java index 68bf5db4..5c013cfb 100644 --- a/shared/src/main/java/com/workup/shared/commands/users/responses/AuthenticationResponse.java +++ b/shared/src/main/java/com/workup/shared/commands/users/responses/AuthenticationResponse.java @@ -1,13 +1,13 @@ package com.workup.shared.commands.users.responses; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import lombok.Builder; import lombok.Getter; +import lombok.experimental.SuperBuilder; +import lombok.extern.jackson.Jacksonized; @Getter -@Builder(setterPrefix = "with") -@JsonDeserialize(builder = AuthenticationResponse.AuthenticationResponseBuilder.class) +@SuperBuilder(setterPrefix = "with") +@Jacksonized public class AuthenticationResponse { - private String email; - private UserType userType; + private String email; + private UserType userType; } diff --git a/shared/src/main/java/com/workup/shared/commands/users/responses/SignUpAndInResponse.java b/shared/src/main/java/com/workup/shared/commands/users/responses/SignUpAndInResponse.java index 4d0c736c..48902472 100644 --- a/shared/src/main/java/com/workup/shared/commands/users/responses/SignUpAndInResponse.java +++ b/shared/src/main/java/com/workup/shared/commands/users/responses/SignUpAndInResponse.java @@ -1,14 +1,14 @@ package com.workup.shared.commands.users.responses; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.workup.shared.commands.CommandResponse; -import lombok.Builder; import lombok.Getter; +import lombok.experimental.SuperBuilder; +import lombok.extern.jackson.Jacksonized; @Getter -@Builder(setterPrefix = "with") -@JsonDeserialize(builder = SignUpAndInResponse.SignUpAndInResponseBuilder.class) +@SuperBuilder(setterPrefix = "with") +@Jacksonized public class SignUpAndInResponse extends CommandResponse { - boolean success; - String authToken; + boolean success; + String authToken; } From a5bbebcda9bcd1fe8f73ffda500af5b10e816e43 Mon Sep 17 00:00:00 2001 From: Akram-Fahim Date: Sun, 28 Apr 2024 22:07:27 +0300 Subject: [PATCH 26/43] Linting Signed-off-by: Akram-Fahim --- .../users/RequestsAndResponsesTest.java | 46 +++++++++---------- .../responses/AuthenticationResponse.java | 1 + .../commands/users/responses/UserType.java | 6 --- .../workup/shared/enums/users/UserType.java | 6 +++ 4 files changed, 29 insertions(+), 30 deletions(-) delete mode 100644 shared/src/main/java/com/workup/shared/commands/users/responses/UserType.java create mode 100644 shared/src/main/java/com/workup/shared/enums/users/UserType.java diff --git a/services/users/src/test/java/com/workup/users/RequestsAndResponsesTest.java b/services/users/src/test/java/com/workup/users/RequestsAndResponsesTest.java index 1a2e6f11..fc381b9c 100644 --- a/services/users/src/test/java/com/workup/users/RequestsAndResponsesTest.java +++ b/services/users/src/test/java/com/workup/users/RequestsAndResponsesTest.java @@ -1,5 +1,7 @@ package com.workup.users; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; + import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.workup.shared.commands.users.requests.AuthenticationRequest; @@ -9,31 +11,27 @@ import com.workup.shared.commands.users.responses.SignUpAndInResponse; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; - public class RequestsAndResponsesTest { - private static Object[] testObjects = { // all requests/responses to be tested - FreelancerRegisterRequest.builder().build(), - SignUpAndInResponse.builder().build(), - AuthenticationRequest.builder().build(), - ClientRegisterRequest.builder().build(), - LoginRequest.builder().build() - }; + private static Object[] testObjects = { // all requests/responses to be tested + FreelancerRegisterRequest.builder().build(), + SignUpAndInResponse.builder().build(), + AuthenticationRequest.builder().build(), + ClientRegisterRequest.builder().build(), + LoginRequest.builder().build() + }; - @Test - public void testSerializationNoExceptionsThrown() throws JsonProcessingException { - ObjectMapper objectMapper = new ObjectMapper(); - for (Object testObject : testObjects) { - String className = testObject.getClass().getName(); - assertDoesNotThrow( - () -> objectMapper.writeValueAsString(testObject), - String.format("Serialization of %s should not throw exceptions", className) - ); - String json = objectMapper.writeValueAsString(testObject); - assertDoesNotThrow( - () -> objectMapper.readValue(json, testObject.getClass()), - String.format("Deserialization of %s should not throw exceptions", className) - ); - } + @Test + public void testSerializationNoExceptionsThrown() throws JsonProcessingException { + ObjectMapper objectMapper = new ObjectMapper(); + for (Object testObject : testObjects) { + String className = testObject.getClass().getName(); + assertDoesNotThrow( + () -> objectMapper.writeValueAsString(testObject), + String.format("Serialization of %s should not throw exceptions", className)); + String json = objectMapper.writeValueAsString(testObject); + assertDoesNotThrow( + () -> objectMapper.readValue(json, testObject.getClass()), + String.format("Deserialization of %s should not throw exceptions", className)); } + } } diff --git a/shared/src/main/java/com/workup/shared/commands/users/responses/AuthenticationResponse.java b/shared/src/main/java/com/workup/shared/commands/users/responses/AuthenticationResponse.java index 5c013cfb..36ff0bd8 100644 --- a/shared/src/main/java/com/workup/shared/commands/users/responses/AuthenticationResponse.java +++ b/shared/src/main/java/com/workup/shared/commands/users/responses/AuthenticationResponse.java @@ -1,5 +1,6 @@ package com.workup.shared.commands.users.responses; +import com.workup.shared.enums.users.UserType; import lombok.Getter; import lombok.experimental.SuperBuilder; import lombok.extern.jackson.Jacksonized; diff --git a/shared/src/main/java/com/workup/shared/commands/users/responses/UserType.java b/shared/src/main/java/com/workup/shared/commands/users/responses/UserType.java deleted file mode 100644 index 2b68d577..00000000 --- a/shared/src/main/java/com/workup/shared/commands/users/responses/UserType.java +++ /dev/null @@ -1,6 +0,0 @@ -package com.workup.shared.commands.users.responses; - -public enum UserType { - FREELANCER, - CLIENT -} diff --git a/shared/src/main/java/com/workup/shared/enums/users/UserType.java b/shared/src/main/java/com/workup/shared/enums/users/UserType.java new file mode 100644 index 00000000..0654d83d --- /dev/null +++ b/shared/src/main/java/com/workup/shared/enums/users/UserType.java @@ -0,0 +1,6 @@ +package com.workup.shared.enums.users; + +public enum UserType { + FREELANCER, + CLIENT +} From 8a8b9dc7c9a0faa640a696e3661a404c2c53fb33 Mon Sep 17 00:00:00 2001 From: Akram-Fahim Date: Sun, 28 Apr 2024 22:08:21 +0300 Subject: [PATCH 27/43] Linting Signed-off-by: Akram-Fahim --- shared/.mvn/jvm.config | 1 + 1 file changed, 1 insertion(+) create mode 100644 shared/.mvn/jvm.config diff --git a/shared/.mvn/jvm.config b/shared/.mvn/jvm.config new file mode 100644 index 00000000..e2a50e08 --- /dev/null +++ b/shared/.mvn/jvm.config @@ -0,0 +1 @@ +--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED \ No newline at end of file From 28d15b0ac92b4a5ae49663033a02fa43633ddf7e Mon Sep 17 00:00:00 2001 From: Akram-Fahim Date: Mon, 29 Apr 2024 13:13:59 +0300 Subject: [PATCH 28/43] Handled Inheritance bug Signed-off-by: Akram-Fahim --- .../shared/commands/users/requests/AuthenticationRequest.java | 3 ++- .../shared/commands/users/requests/ClientRegisterRequest.java | 3 ++- .../workup/shared/commands/users/requests/LoginRequest.java | 3 ++- .../commands/users/responses/AuthenticationResponse.java | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/AuthenticationRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/AuthenticationRequest.java index 9b759355..79d9bbd5 100644 --- a/shared/src/main/java/com/workup/shared/commands/users/requests/AuthenticationRequest.java +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/AuthenticationRequest.java @@ -1,5 +1,6 @@ package com.workup.shared.commands.users.requests; +import com.workup.shared.commands.CommandRequest; import lombok.Getter; import lombok.experimental.SuperBuilder; import lombok.extern.jackson.Jacksonized; @@ -7,6 +8,6 @@ @Getter @SuperBuilder(setterPrefix = "with") @Jacksonized -public class AuthenticationRequest { +public class AuthenticationRequest extends CommandRequest { private String authToken; } diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/ClientRegisterRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/ClientRegisterRequest.java index 42260a36..46140c68 100644 --- a/shared/src/main/java/com/workup/shared/commands/users/requests/ClientRegisterRequest.java +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/ClientRegisterRequest.java @@ -1,5 +1,6 @@ package com.workup.shared.commands.users.requests; +import com.workup.shared.commands.CommandRequest; import lombok.Getter; import lombok.experimental.SuperBuilder; import lombok.extern.jackson.Jacksonized; @@ -7,7 +8,7 @@ @Getter @SuperBuilder(setterPrefix = "with") @Jacksonized -public class ClientRegisterRequest { +public class ClientRegisterRequest extends CommandRequest { private String email; private String passwordHash; private String clientName; diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/LoginRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/LoginRequest.java index c89d10c1..d8f446e9 100644 --- a/shared/src/main/java/com/workup/shared/commands/users/requests/LoginRequest.java +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/LoginRequest.java @@ -1,5 +1,6 @@ package com.workup.shared.commands.users.requests; +import com.workup.shared.commands.CommandRequest; import lombok.Getter; import lombok.experimental.SuperBuilder; import lombok.extern.jackson.Jacksonized; @@ -7,7 +8,7 @@ @Getter @SuperBuilder(setterPrefix = "with") @Jacksonized -public class LoginRequest { +public class LoginRequest extends CommandRequest { private String email; private String passwordHash; } diff --git a/shared/src/main/java/com/workup/shared/commands/users/responses/AuthenticationResponse.java b/shared/src/main/java/com/workup/shared/commands/users/responses/AuthenticationResponse.java index 36ff0bd8..570f9a6a 100644 --- a/shared/src/main/java/com/workup/shared/commands/users/responses/AuthenticationResponse.java +++ b/shared/src/main/java/com/workup/shared/commands/users/responses/AuthenticationResponse.java @@ -1,5 +1,6 @@ package com.workup.shared.commands.users.responses; +import com.workup.shared.commands.CommandResponse; import com.workup.shared.enums.users.UserType; import lombok.Getter; import lombok.experimental.SuperBuilder; @@ -8,7 +9,7 @@ @Getter @SuperBuilder(setterPrefix = "with") @Jacksonized -public class AuthenticationResponse { +public class AuthenticationResponse extends CommandResponse { private String email; private UserType userType; } From 7128714cb7b2782bec4227b6f34eb375df79cdb5 Mon Sep 17 00:00:00 2001 From: Akram-Fahim Date: Mon, 29 Apr 2024 13:19:46 +0300 Subject: [PATCH 29/43] Removed the success boolean as suggested by @Ahmad45123 Signed-off-by: Akram-Fahim --- .../shared/commands/users/responses/SignUpAndInResponse.java | 1 - 1 file changed, 1 deletion(-) diff --git a/shared/src/main/java/com/workup/shared/commands/users/responses/SignUpAndInResponse.java b/shared/src/main/java/com/workup/shared/commands/users/responses/SignUpAndInResponse.java index 48902472..488ed021 100644 --- a/shared/src/main/java/com/workup/shared/commands/users/responses/SignUpAndInResponse.java +++ b/shared/src/main/java/com/workup/shared/commands/users/responses/SignUpAndInResponse.java @@ -9,6 +9,5 @@ @SuperBuilder(setterPrefix = "with") @Jacksonized public class SignUpAndInResponse extends CommandResponse { - boolean success; String authToken; } From 090ae5bc1b4ddb0fcc34243714367e1be8cdfb31 Mon Sep 17 00:00:00 2001 From: Akram-Fahim Date: Wed, 1 May 2024 11:23:54 +0300 Subject: [PATCH 30/43] Addressed Noureldin's comments Signed-off-by: Akram-Fahim --- .../shared/commands/users/requests/ClientRegisterRequest.java | 2 +- .../commands/users/requests/FreelancerRegisterRequest.java | 2 +- .../com/workup/shared/commands/users/requests/LoginRequest.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/ClientRegisterRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/ClientRegisterRequest.java index 46140c68..b9371443 100644 --- a/shared/src/main/java/com/workup/shared/commands/users/requests/ClientRegisterRequest.java +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/ClientRegisterRequest.java @@ -10,7 +10,7 @@ @Jacksonized public class ClientRegisterRequest extends CommandRequest { private String email; - private String passwordHash; + private String password; private String clientName; private String industry; private String city; diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerRegisterRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerRegisterRequest.java index 6f2875ac..73fbe1de 100644 --- a/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerRegisterRequest.java +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerRegisterRequest.java @@ -11,7 +11,7 @@ @Jacksonized public class FreelancerRegisterRequest extends CommandRequest { private String email; - private String passwordHash; + private String password; private String fullName; private String jobTitle; private String city; diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/LoginRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/LoginRequest.java index d8f446e9..ed7fc438 100644 --- a/shared/src/main/java/com/workup/shared/commands/users/requests/LoginRequest.java +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/LoginRequest.java @@ -10,5 +10,5 @@ @Jacksonized public class LoginRequest extends CommandRequest { private String email; - private String passwordHash; + private String password; } From 0460a97a23ba71d2a8c0ebfaf211362950a92213 Mon Sep 17 00:00:00 2001 From: Akram-Fahim Date: Mon, 4 Mar 2024 11:52:54 +0200 Subject: [PATCH 31/43] Created Users module, and added FreelancerRegister request and response --- .../requests/FreelancerRegisterRequest.java | 16 ++++++++++++++++ .../responses/FreelancerRegisterResponse.java | 9 +++++++++ 2 files changed, 25 insertions(+) create mode 100644 services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java create mode 100644 services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java diff --git a/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java b/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java new file mode 100644 index 00000000..b33c01d8 --- /dev/null +++ b/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java @@ -0,0 +1,16 @@ +package com.workup.users.requests; +import com.workup.shared.commands.CommandRequest; +import lombok.Builder; +import lombok.NonNull; + +import java.util.Date; + +@Builder +public class FreelancerRegisterRequest extends CommandRequest { + @NonNull String email; + @NonNull String passwordHash; + @NonNull String fullName; + String jobTitle; + String city; + Date birthDate; +} diff --git a/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java b/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java new file mode 100644 index 00000000..68c4d81e --- /dev/null +++ b/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java @@ -0,0 +1,9 @@ +package com.workup.users.responses; + +import com.workup.shared.commands.CommandResponse; +import lombok.NonNull; + +public class FreelancerRegisterResponse extends CommandResponse { + @NonNull boolean success; + String authToken; +} From 236c829220105acee0642fde8554091caf932d67 Mon Sep 17 00:00:00 2001 From: Akram-Fahim Date: Mon, 4 Mar 2024 15:08:48 +0200 Subject: [PATCH 32/43] Addressed @Ahmad45123's comments and created a test to verify the serialization process. --- .../requests/FreelancerRegisterRequest.java | 16 ---------------- .../responses/FreelancerRegisterResponse.java | 9 --------- .../users/requests/FreelancerLoginRequest.java | 9 +++++++++ 3 files changed, 9 insertions(+), 25 deletions(-) delete mode 100644 services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java delete mode 100644 services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java create mode 100644 shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java diff --git a/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java b/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java deleted file mode 100644 index b33c01d8..00000000 --- a/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.workup.users.requests; -import com.workup.shared.commands.CommandRequest; -import lombok.Builder; -import lombok.NonNull; - -import java.util.Date; - -@Builder -public class FreelancerRegisterRequest extends CommandRequest { - @NonNull String email; - @NonNull String passwordHash; - @NonNull String fullName; - String jobTitle; - String city; - Date birthDate; -} diff --git a/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java b/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java deleted file mode 100644 index 68c4d81e..00000000 --- a/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.workup.users.responses; - -import com.workup.shared.commands.CommandResponse; -import lombok.NonNull; - -public class FreelancerRegisterResponse extends CommandResponse { - @NonNull boolean success; - String authToken; -} diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java new file mode 100644 index 00000000..b278398d --- /dev/null +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerLoginRequest.java @@ -0,0 +1,9 @@ +//package com.workup.users.requests; +// +//public class FreelancerLoginRequest { +// String email = ""; +// +// @NonNull +// @Builder.Default +// String passwordHash = ""; +//} From 10c08af0511ea90eaf3b3739e08bf8a15d055ab6 Mon Sep 17 00:00:00 2001 From: Akram-Fahim Date: Mon, 4 Mar 2024 11:52:54 +0200 Subject: [PATCH 33/43] Created Users module, and added FreelancerRegister request and response --- .../requests/FreelancerRegisterRequest.java | 16 ++++++++++++++++ .../responses/FreelancerRegisterResponse.java | 9 +++++++++ 2 files changed, 25 insertions(+) create mode 100644 services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java create mode 100644 services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java diff --git a/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java b/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java new file mode 100644 index 00000000..b33c01d8 --- /dev/null +++ b/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java @@ -0,0 +1,16 @@ +package com.workup.users.requests; +import com.workup.shared.commands.CommandRequest; +import lombok.Builder; +import lombok.NonNull; + +import java.util.Date; + +@Builder +public class FreelancerRegisterRequest extends CommandRequest { + @NonNull String email; + @NonNull String passwordHash; + @NonNull String fullName; + String jobTitle; + String city; + Date birthDate; +} diff --git a/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java b/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java new file mode 100644 index 00000000..68c4d81e --- /dev/null +++ b/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java @@ -0,0 +1,9 @@ +package com.workup.users.responses; + +import com.workup.shared.commands.CommandResponse; +import lombok.NonNull; + +public class FreelancerRegisterResponse extends CommandResponse { + @NonNull boolean success; + String authToken; +} From 0839746912b45eda6060e63966b10fc21e736a67 Mon Sep 17 00:00:00 2001 From: Akram-Fahim Date: Mon, 4 Mar 2024 15:08:48 +0200 Subject: [PATCH 34/43] Addressed @Ahmad45123's comments and created a test to verify the serialization process. --- .../requests/FreelancerRegisterRequest.java | 16 ---------------- .../responses/FreelancerRegisterResponse.java | 9 --------- 2 files changed, 25 deletions(-) delete mode 100644 services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java delete mode 100644 services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java diff --git a/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java b/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java deleted file mode 100644 index b33c01d8..00000000 --- a/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.workup.users.requests; -import com.workup.shared.commands.CommandRequest; -import lombok.Builder; -import lombok.NonNull; - -import java.util.Date; - -@Builder -public class FreelancerRegisterRequest extends CommandRequest { - @NonNull String email; - @NonNull String passwordHash; - @NonNull String fullName; - String jobTitle; - String city; - Date birthDate; -} diff --git a/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java b/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java deleted file mode 100644 index 68c4d81e..00000000 --- a/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.workup.users.responses; - -import com.workup.shared.commands.CommandResponse; -import lombok.NonNull; - -public class FreelancerRegisterResponse extends CommandResponse { - @NonNull boolean success; - String authToken; -} From e03e46b1dd13aed609298c3e804c378d9617141d Mon Sep 17 00:00:00 2001 From: Akram-Fahim Date: Sun, 28 Apr 2024 20:59:59 +0300 Subject: [PATCH 35/43] Added all required Authentication (register/login) requests and responses Signed-off-by: Akram-Fahim --- .../users/RequestsAndResponsesTest.java | 47 +++++++++++-------- .../users/requests/AuthenticationRequest.java | 12 +++++ .../users/requests/ClientRegisterRequest.java | 19 ++++++++ .../requests/FreelancerRegisterRequest.java | 23 ++++----- .../commands/users/requests/LoginRequest.java | 13 +++++ .../responses/AuthenticationResponse.java | 13 +++++ .../responses/FreelancerRegisterResponse.java | 14 ------ .../users/responses/SignUpAndInResponse.java | 14 ++++++ .../commands/users/responses/UserType.java | 6 +++ 9 files changed, 117 insertions(+), 44 deletions(-) create mode 100644 shared/src/main/java/com/workup/shared/commands/users/requests/AuthenticationRequest.java create mode 100644 shared/src/main/java/com/workup/shared/commands/users/requests/ClientRegisterRequest.java create mode 100644 shared/src/main/java/com/workup/shared/commands/users/requests/LoginRequest.java create mode 100644 shared/src/main/java/com/workup/shared/commands/users/responses/AuthenticationResponse.java delete mode 100644 shared/src/main/java/com/workup/shared/commands/users/responses/FreelancerRegisterResponse.java create mode 100644 shared/src/main/java/com/workup/shared/commands/users/responses/SignUpAndInResponse.java create mode 100644 shared/src/main/java/com/workup/shared/commands/users/responses/UserType.java diff --git a/services/users/src/test/java/com/workup/users/RequestsAndResponsesTest.java b/services/users/src/test/java/com/workup/users/RequestsAndResponsesTest.java index f005e3a8..1a2e6f11 100644 --- a/services/users/src/test/java/com/workup/users/RequestsAndResponsesTest.java +++ b/services/users/src/test/java/com/workup/users/RequestsAndResponsesTest.java @@ -1,30 +1,39 @@ package com.workup.users; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; - import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; +import com.workup.shared.commands.users.requests.AuthenticationRequest; +import com.workup.shared.commands.users.requests.ClientRegisterRequest; import com.workup.shared.commands.users.requests.FreelancerRegisterRequest; -import com.workup.shared.commands.users.responses.FreelancerRegisterResponse; +import com.workup.shared.commands.users.requests.LoginRequest; +import com.workup.shared.commands.users.responses.SignUpAndInResponse; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; + public class RequestsAndResponsesTest { - private static Object[] testObjects = { // all requests/responses to be tested - FreelancerRegisterRequest.builder().build(), FreelancerRegisterResponse.builder().build(), - }; + private static Object[] testObjects = { // all requests/responses to be tested + FreelancerRegisterRequest.builder().build(), + SignUpAndInResponse.builder().build(), + AuthenticationRequest.builder().build(), + ClientRegisterRequest.builder().build(), + LoginRequest.builder().build() + }; - @Test - public void testSerializationNoExceptionsThrown() throws JsonProcessingException { - ObjectMapper objectMapper = new ObjectMapper(); - for (Object testObject : testObjects) { - String className = testObject.getClass().getName(); - assertDoesNotThrow( - () -> objectMapper.writeValueAsString(testObject), - String.format("Serialization of %s should not throw exceptions", className)); - String json = objectMapper.writeValueAsString(testObject); - assertDoesNotThrow( - () -> objectMapper.readValue(json, testObject.getClass()), - String.format("Deserialization of %s should not throw exceptions", className)); + @Test + public void testSerializationNoExceptionsThrown() throws JsonProcessingException { + ObjectMapper objectMapper = new ObjectMapper(); + for (Object testObject : testObjects) { + String className = testObject.getClass().getName(); + assertDoesNotThrow( + () -> objectMapper.writeValueAsString(testObject), + String.format("Serialization of %s should not throw exceptions", className) + ); + String json = objectMapper.writeValueAsString(testObject); + assertDoesNotThrow( + () -> objectMapper.readValue(json, testObject.getClass()), + String.format("Deserialization of %s should not throw exceptions", className) + ); + } } - } } diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/AuthenticationRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/AuthenticationRequest.java new file mode 100644 index 00000000..d5e870bb --- /dev/null +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/AuthenticationRequest.java @@ -0,0 +1,12 @@ +package com.workup.shared.commands.users.requests; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import lombok.Builder; +import lombok.Getter; + +@Getter +@Builder(setterPrefix = "with") +@JsonDeserialize(builder = AuthenticationRequest.AuthenticationRequestBuilder.class) +public class AuthenticationRequest { + private String authToken; +} diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/ClientRegisterRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/ClientRegisterRequest.java new file mode 100644 index 00000000..9108cd8e --- /dev/null +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/ClientRegisterRequest.java @@ -0,0 +1,19 @@ +package com.workup.shared.commands.users.requests; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import lombok.Builder; +import lombok.Getter; + +@Getter +@Builder(setterPrefix = "with") +@JsonDeserialize(builder = ClientRegisterRequest.ClientRegisterRequestBuilder.class) +public class ClientRegisterRequest { + private String email; + private String passwordHash; + private String clientName; + private String industry; + private String city; + private String photoId; + private String description; + private Integer employeeCount; +} diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerRegisterRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerRegisterRequest.java index 98b75ecc..1336ec01 100644 --- a/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerRegisterRequest.java +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerRegisterRequest.java @@ -1,19 +1,20 @@ package com.workup.shared.commands.users.requests; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.workup.shared.commands.CommandRequest; -import java.util.Date; +import lombok.Builder; import lombok.Getter; -import lombok.experimental.SuperBuilder; -import lombok.extern.jackson.Jacksonized; + +import java.util.Date; @Getter -@SuperBuilder(setterPrefix = "with") -@Jacksonized +@Builder(setterPrefix = "with") +@JsonDeserialize(builder = FreelancerRegisterRequest.FreelancerRegisterRequestBuilder.class) public class FreelancerRegisterRequest extends CommandRequest { - public String email; - public String passwordHash; - public String fullName; - public String jobTitle; - public String city; - public Date birthDate; + private String email; + private String passwordHash; + private String fullName; + private String jobTitle; + private String city; + private Date birthDate; } diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/LoginRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/LoginRequest.java new file mode 100644 index 00000000..ef1737bc --- /dev/null +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/LoginRequest.java @@ -0,0 +1,13 @@ +package com.workup.shared.commands.users.requests; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import lombok.Builder; +import lombok.Getter; + +@Getter +@Builder(setterPrefix = "with") +@JsonDeserialize(builder = LoginRequest.LoginRequestBuilder.class) +public class LoginRequest { + private String email; + private String passwordHash; +} diff --git a/shared/src/main/java/com/workup/shared/commands/users/responses/AuthenticationResponse.java b/shared/src/main/java/com/workup/shared/commands/users/responses/AuthenticationResponse.java new file mode 100644 index 00000000..68bf5db4 --- /dev/null +++ b/shared/src/main/java/com/workup/shared/commands/users/responses/AuthenticationResponse.java @@ -0,0 +1,13 @@ +package com.workup.shared.commands.users.responses; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import lombok.Builder; +import lombok.Getter; + +@Getter +@Builder(setterPrefix = "with") +@JsonDeserialize(builder = AuthenticationResponse.AuthenticationResponseBuilder.class) +public class AuthenticationResponse { + private String email; + private UserType userType; +} diff --git a/shared/src/main/java/com/workup/shared/commands/users/responses/FreelancerRegisterResponse.java b/shared/src/main/java/com/workup/shared/commands/users/responses/FreelancerRegisterResponse.java deleted file mode 100644 index 0dfabc7d..00000000 --- a/shared/src/main/java/com/workup/shared/commands/users/responses/FreelancerRegisterResponse.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.workup.shared.commands.users.responses; - -import com.workup.shared.commands.CommandResponse; -import lombok.Getter; -import lombok.experimental.SuperBuilder; -import lombok.extern.jackson.Jacksonized; - -@Getter -@SuperBuilder(setterPrefix = "with") -@Jacksonized -public class FreelancerRegisterResponse extends CommandResponse { - public boolean success; - public String authToken; -} diff --git a/shared/src/main/java/com/workup/shared/commands/users/responses/SignUpAndInResponse.java b/shared/src/main/java/com/workup/shared/commands/users/responses/SignUpAndInResponse.java new file mode 100644 index 00000000..4d0c736c --- /dev/null +++ b/shared/src/main/java/com/workup/shared/commands/users/responses/SignUpAndInResponse.java @@ -0,0 +1,14 @@ +package com.workup.shared.commands.users.responses; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.workup.shared.commands.CommandResponse; +import lombok.Builder; +import lombok.Getter; + +@Getter +@Builder(setterPrefix = "with") +@JsonDeserialize(builder = SignUpAndInResponse.SignUpAndInResponseBuilder.class) +public class SignUpAndInResponse extends CommandResponse { + boolean success; + String authToken; +} diff --git a/shared/src/main/java/com/workup/shared/commands/users/responses/UserType.java b/shared/src/main/java/com/workup/shared/commands/users/responses/UserType.java new file mode 100644 index 00000000..2b68d577 --- /dev/null +++ b/shared/src/main/java/com/workup/shared/commands/users/responses/UserType.java @@ -0,0 +1,6 @@ +package com.workup.shared.commands.users.responses; + +public enum UserType { + FREELANCER, + CLIENT +} From 2a604dd12f06bcfc39df3f3d85c8b45919e8baa4 Mon Sep 17 00:00:00 2001 From: Akram-Fahim Date: Mon, 4 Mar 2024 11:52:54 +0200 Subject: [PATCH 36/43] Created Users module, and added FreelancerRegister request and response --- .../requests/FreelancerRegisterRequest.java | 16 ++++++++++++++++ .../responses/FreelancerRegisterResponse.java | 9 +++++++++ 2 files changed, 25 insertions(+) create mode 100644 services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java create mode 100644 services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java diff --git a/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java b/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java new file mode 100644 index 00000000..b33c01d8 --- /dev/null +++ b/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java @@ -0,0 +1,16 @@ +package com.workup.users.requests; +import com.workup.shared.commands.CommandRequest; +import lombok.Builder; +import lombok.NonNull; + +import java.util.Date; + +@Builder +public class FreelancerRegisterRequest extends CommandRequest { + @NonNull String email; + @NonNull String passwordHash; + @NonNull String fullName; + String jobTitle; + String city; + Date birthDate; +} diff --git a/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java b/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java new file mode 100644 index 00000000..68c4d81e --- /dev/null +++ b/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java @@ -0,0 +1,9 @@ +package com.workup.users.responses; + +import com.workup.shared.commands.CommandResponse; +import lombok.NonNull; + +public class FreelancerRegisterResponse extends CommandResponse { + @NonNull boolean success; + String authToken; +} From d9cbbebc9549c1f635daf7e2d81f0c9a7b5476b1 Mon Sep 17 00:00:00 2001 From: Akram-Fahim Date: Mon, 4 Mar 2024 15:08:48 +0200 Subject: [PATCH 37/43] Addressed @Ahmad45123's comments and created a test to verify the serialization process. --- .../requests/FreelancerRegisterRequest.java | 16 ---------------- .../responses/FreelancerRegisterResponse.java | 9 --------- 2 files changed, 25 deletions(-) delete mode 100644 services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java delete mode 100644 services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java diff --git a/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java b/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java deleted file mode 100644 index b33c01d8..00000000 --- a/services/users/src/main/java/com/workup/users/requests/FreelancerRegisterRequest.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.workup.users.requests; -import com.workup.shared.commands.CommandRequest; -import lombok.Builder; -import lombok.NonNull; - -import java.util.Date; - -@Builder -public class FreelancerRegisterRequest extends CommandRequest { - @NonNull String email; - @NonNull String passwordHash; - @NonNull String fullName; - String jobTitle; - String city; - Date birthDate; -} diff --git a/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java b/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java deleted file mode 100644 index 68c4d81e..00000000 --- a/services/users/src/main/java/com/workup/users/responses/FreelancerRegisterResponse.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.workup.users.responses; - -import com.workup.shared.commands.CommandResponse; -import lombok.NonNull; - -public class FreelancerRegisterResponse extends CommandResponse { - @NonNull boolean success; - String authToken; -} From d76702179cc9e9f878a581e41c681161a9e11718 Mon Sep 17 00:00:00 2001 From: Akram-Fahim Date: Sun, 28 Apr 2024 20:59:59 +0300 Subject: [PATCH 38/43] Added all required Authentication (register/login) requests and responses Signed-off-by: Akram-Fahim --- .../users/responses/FreelancerGetPhotoResponse.java | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 shared/src/main/java/com/workup/shared/commands/users/responses/FreelancerGetPhotoResponse.java diff --git a/shared/src/main/java/com/workup/shared/commands/users/responses/FreelancerGetPhotoResponse.java b/shared/src/main/java/com/workup/shared/commands/users/responses/FreelancerGetPhotoResponse.java deleted file mode 100644 index 819fbc5a..00000000 --- a/shared/src/main/java/com/workup/shared/commands/users/responses/FreelancerGetPhotoResponse.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.workup.shared.commands.users.responses; - -import com.workup.shared.commands.CommandResponse; -import lombok.Getter; -import lombok.experimental.SuperBuilder; -import lombok.extern.jackson.Jacksonized; - -@Getter -@SuperBuilder(setterPrefix = "with") -@Jacksonized -public class FreelancerGetPhotoResponse extends CommandResponse { - public String photoLink; -} From a2d9f3c2ef2cc6a59e39110746f9cf0fefe42695 Mon Sep 17 00:00:00 2001 From: Akram-Fahim Date: Sun, 28 Apr 2024 21:29:40 +0300 Subject: [PATCH 39/43] Updated the annotations to match the ones requested by @Ahmad45123 Signed-off-by: Akram-Fahim --- .../users/requests/AuthenticationRequest.java | 10 ++++---- .../users/requests/ClientRegisterRequest.java | 24 +++++++++---------- .../requests/FreelancerRegisterRequest.java | 23 +++++++++--------- .../commands/users/requests/LoginRequest.java | 12 +++++----- .../responses/AuthenticationResponse.java | 12 +++++----- .../users/responses/SignUpAndInResponse.java | 12 +++++----- 6 files changed, 46 insertions(+), 47 deletions(-) diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/AuthenticationRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/AuthenticationRequest.java index d5e870bb..9b759355 100644 --- a/shared/src/main/java/com/workup/shared/commands/users/requests/AuthenticationRequest.java +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/AuthenticationRequest.java @@ -1,12 +1,12 @@ package com.workup.shared.commands.users.requests; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import lombok.Builder; import lombok.Getter; +import lombok.experimental.SuperBuilder; +import lombok.extern.jackson.Jacksonized; @Getter -@Builder(setterPrefix = "with") -@JsonDeserialize(builder = AuthenticationRequest.AuthenticationRequestBuilder.class) +@SuperBuilder(setterPrefix = "with") +@Jacksonized public class AuthenticationRequest { - private String authToken; + private String authToken; } diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/ClientRegisterRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/ClientRegisterRequest.java index 9108cd8e..42260a36 100644 --- a/shared/src/main/java/com/workup/shared/commands/users/requests/ClientRegisterRequest.java +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/ClientRegisterRequest.java @@ -1,19 +1,19 @@ package com.workup.shared.commands.users.requests; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import lombok.Builder; import lombok.Getter; +import lombok.experimental.SuperBuilder; +import lombok.extern.jackson.Jacksonized; @Getter -@Builder(setterPrefix = "with") -@JsonDeserialize(builder = ClientRegisterRequest.ClientRegisterRequestBuilder.class) +@SuperBuilder(setterPrefix = "with") +@Jacksonized public class ClientRegisterRequest { - private String email; - private String passwordHash; - private String clientName; - private String industry; - private String city; - private String photoId; - private String description; - private Integer employeeCount; + private String email; + private String passwordHash; + private String clientName; + private String industry; + private String city; + private String photoId; + private String description; + private Integer employeeCount; } diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerRegisterRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerRegisterRequest.java index 1336ec01..6f2875ac 100644 --- a/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerRegisterRequest.java +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerRegisterRequest.java @@ -1,20 +1,19 @@ package com.workup.shared.commands.users.requests; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.workup.shared.commands.CommandRequest; -import lombok.Builder; -import lombok.Getter; - import java.util.Date; +import lombok.Getter; +import lombok.experimental.SuperBuilder; +import lombok.extern.jackson.Jacksonized; @Getter -@Builder(setterPrefix = "with") -@JsonDeserialize(builder = FreelancerRegisterRequest.FreelancerRegisterRequestBuilder.class) +@SuperBuilder(setterPrefix = "with") +@Jacksonized public class FreelancerRegisterRequest extends CommandRequest { - private String email; - private String passwordHash; - private String fullName; - private String jobTitle; - private String city; - private Date birthDate; + private String email; + private String passwordHash; + private String fullName; + private String jobTitle; + private String city; + private Date birthDate; } diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/LoginRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/LoginRequest.java index ef1737bc..c89d10c1 100644 --- a/shared/src/main/java/com/workup/shared/commands/users/requests/LoginRequest.java +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/LoginRequest.java @@ -1,13 +1,13 @@ package com.workup.shared.commands.users.requests; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import lombok.Builder; import lombok.Getter; +import lombok.experimental.SuperBuilder; +import lombok.extern.jackson.Jacksonized; @Getter -@Builder(setterPrefix = "with") -@JsonDeserialize(builder = LoginRequest.LoginRequestBuilder.class) +@SuperBuilder(setterPrefix = "with") +@Jacksonized public class LoginRequest { - private String email; - private String passwordHash; + private String email; + private String passwordHash; } diff --git a/shared/src/main/java/com/workup/shared/commands/users/responses/AuthenticationResponse.java b/shared/src/main/java/com/workup/shared/commands/users/responses/AuthenticationResponse.java index 68bf5db4..5c013cfb 100644 --- a/shared/src/main/java/com/workup/shared/commands/users/responses/AuthenticationResponse.java +++ b/shared/src/main/java/com/workup/shared/commands/users/responses/AuthenticationResponse.java @@ -1,13 +1,13 @@ package com.workup.shared.commands.users.responses; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import lombok.Builder; import lombok.Getter; +import lombok.experimental.SuperBuilder; +import lombok.extern.jackson.Jacksonized; @Getter -@Builder(setterPrefix = "with") -@JsonDeserialize(builder = AuthenticationResponse.AuthenticationResponseBuilder.class) +@SuperBuilder(setterPrefix = "with") +@Jacksonized public class AuthenticationResponse { - private String email; - private UserType userType; + private String email; + private UserType userType; } diff --git a/shared/src/main/java/com/workup/shared/commands/users/responses/SignUpAndInResponse.java b/shared/src/main/java/com/workup/shared/commands/users/responses/SignUpAndInResponse.java index 4d0c736c..48902472 100644 --- a/shared/src/main/java/com/workup/shared/commands/users/responses/SignUpAndInResponse.java +++ b/shared/src/main/java/com/workup/shared/commands/users/responses/SignUpAndInResponse.java @@ -1,14 +1,14 @@ package com.workup.shared.commands.users.responses; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.workup.shared.commands.CommandResponse; -import lombok.Builder; import lombok.Getter; +import lombok.experimental.SuperBuilder; +import lombok.extern.jackson.Jacksonized; @Getter -@Builder(setterPrefix = "with") -@JsonDeserialize(builder = SignUpAndInResponse.SignUpAndInResponseBuilder.class) +@SuperBuilder(setterPrefix = "with") +@Jacksonized public class SignUpAndInResponse extends CommandResponse { - boolean success; - String authToken; + boolean success; + String authToken; } From 5570cd419d98d1facd30ebd688191ff8745e5b7f Mon Sep 17 00:00:00 2001 From: Akram-Fahim Date: Sun, 28 Apr 2024 22:07:27 +0300 Subject: [PATCH 40/43] Linting Signed-off-by: Akram-Fahim --- .../users/RequestsAndResponsesTest.java | 46 +++++++++---------- .../responses/AuthenticationResponse.java | 1 + .../commands/users/responses/UserType.java | 6 --- .../workup/shared/enums/users/UserType.java | 6 +++ 4 files changed, 29 insertions(+), 30 deletions(-) delete mode 100644 shared/src/main/java/com/workup/shared/commands/users/responses/UserType.java create mode 100644 shared/src/main/java/com/workup/shared/enums/users/UserType.java diff --git a/services/users/src/test/java/com/workup/users/RequestsAndResponsesTest.java b/services/users/src/test/java/com/workup/users/RequestsAndResponsesTest.java index 1a2e6f11..fc381b9c 100644 --- a/services/users/src/test/java/com/workup/users/RequestsAndResponsesTest.java +++ b/services/users/src/test/java/com/workup/users/RequestsAndResponsesTest.java @@ -1,5 +1,7 @@ package com.workup.users; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; + import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.workup.shared.commands.users.requests.AuthenticationRequest; @@ -9,31 +11,27 @@ import com.workup.shared.commands.users.responses.SignUpAndInResponse; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; - public class RequestsAndResponsesTest { - private static Object[] testObjects = { // all requests/responses to be tested - FreelancerRegisterRequest.builder().build(), - SignUpAndInResponse.builder().build(), - AuthenticationRequest.builder().build(), - ClientRegisterRequest.builder().build(), - LoginRequest.builder().build() - }; + private static Object[] testObjects = { // all requests/responses to be tested + FreelancerRegisterRequest.builder().build(), + SignUpAndInResponse.builder().build(), + AuthenticationRequest.builder().build(), + ClientRegisterRequest.builder().build(), + LoginRequest.builder().build() + }; - @Test - public void testSerializationNoExceptionsThrown() throws JsonProcessingException { - ObjectMapper objectMapper = new ObjectMapper(); - for (Object testObject : testObjects) { - String className = testObject.getClass().getName(); - assertDoesNotThrow( - () -> objectMapper.writeValueAsString(testObject), - String.format("Serialization of %s should not throw exceptions", className) - ); - String json = objectMapper.writeValueAsString(testObject); - assertDoesNotThrow( - () -> objectMapper.readValue(json, testObject.getClass()), - String.format("Deserialization of %s should not throw exceptions", className) - ); - } + @Test + public void testSerializationNoExceptionsThrown() throws JsonProcessingException { + ObjectMapper objectMapper = new ObjectMapper(); + for (Object testObject : testObjects) { + String className = testObject.getClass().getName(); + assertDoesNotThrow( + () -> objectMapper.writeValueAsString(testObject), + String.format("Serialization of %s should not throw exceptions", className)); + String json = objectMapper.writeValueAsString(testObject); + assertDoesNotThrow( + () -> objectMapper.readValue(json, testObject.getClass()), + String.format("Deserialization of %s should not throw exceptions", className)); } + } } diff --git a/shared/src/main/java/com/workup/shared/commands/users/responses/AuthenticationResponse.java b/shared/src/main/java/com/workup/shared/commands/users/responses/AuthenticationResponse.java index 5c013cfb..36ff0bd8 100644 --- a/shared/src/main/java/com/workup/shared/commands/users/responses/AuthenticationResponse.java +++ b/shared/src/main/java/com/workup/shared/commands/users/responses/AuthenticationResponse.java @@ -1,5 +1,6 @@ package com.workup.shared.commands.users.responses; +import com.workup.shared.enums.users.UserType; import lombok.Getter; import lombok.experimental.SuperBuilder; import lombok.extern.jackson.Jacksonized; diff --git a/shared/src/main/java/com/workup/shared/commands/users/responses/UserType.java b/shared/src/main/java/com/workup/shared/commands/users/responses/UserType.java deleted file mode 100644 index 2b68d577..00000000 --- a/shared/src/main/java/com/workup/shared/commands/users/responses/UserType.java +++ /dev/null @@ -1,6 +0,0 @@ -package com.workup.shared.commands.users.responses; - -public enum UserType { - FREELANCER, - CLIENT -} diff --git a/shared/src/main/java/com/workup/shared/enums/users/UserType.java b/shared/src/main/java/com/workup/shared/enums/users/UserType.java new file mode 100644 index 00000000..0654d83d --- /dev/null +++ b/shared/src/main/java/com/workup/shared/enums/users/UserType.java @@ -0,0 +1,6 @@ +package com.workup.shared.enums.users; + +public enum UserType { + FREELANCER, + CLIENT +} From 9297159b02c28eaf8e3c9e55ae7e15b9deb0e58d Mon Sep 17 00:00:00 2001 From: Akram-Fahim Date: Mon, 29 Apr 2024 13:13:59 +0300 Subject: [PATCH 41/43] Handled Inheritance bug Signed-off-by: Akram-Fahim --- .../shared/commands/users/requests/AuthenticationRequest.java | 3 ++- .../shared/commands/users/requests/ClientRegisterRequest.java | 3 ++- .../workup/shared/commands/users/requests/LoginRequest.java | 3 ++- .../commands/users/responses/AuthenticationResponse.java | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/AuthenticationRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/AuthenticationRequest.java index 9b759355..79d9bbd5 100644 --- a/shared/src/main/java/com/workup/shared/commands/users/requests/AuthenticationRequest.java +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/AuthenticationRequest.java @@ -1,5 +1,6 @@ package com.workup.shared.commands.users.requests; +import com.workup.shared.commands.CommandRequest; import lombok.Getter; import lombok.experimental.SuperBuilder; import lombok.extern.jackson.Jacksonized; @@ -7,6 +8,6 @@ @Getter @SuperBuilder(setterPrefix = "with") @Jacksonized -public class AuthenticationRequest { +public class AuthenticationRequest extends CommandRequest { private String authToken; } diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/ClientRegisterRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/ClientRegisterRequest.java index 42260a36..46140c68 100644 --- a/shared/src/main/java/com/workup/shared/commands/users/requests/ClientRegisterRequest.java +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/ClientRegisterRequest.java @@ -1,5 +1,6 @@ package com.workup.shared.commands.users.requests; +import com.workup.shared.commands.CommandRequest; import lombok.Getter; import lombok.experimental.SuperBuilder; import lombok.extern.jackson.Jacksonized; @@ -7,7 +8,7 @@ @Getter @SuperBuilder(setterPrefix = "with") @Jacksonized -public class ClientRegisterRequest { +public class ClientRegisterRequest extends CommandRequest { private String email; private String passwordHash; private String clientName; diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/LoginRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/LoginRequest.java index c89d10c1..d8f446e9 100644 --- a/shared/src/main/java/com/workup/shared/commands/users/requests/LoginRequest.java +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/LoginRequest.java @@ -1,5 +1,6 @@ package com.workup.shared.commands.users.requests; +import com.workup.shared.commands.CommandRequest; import lombok.Getter; import lombok.experimental.SuperBuilder; import lombok.extern.jackson.Jacksonized; @@ -7,7 +8,7 @@ @Getter @SuperBuilder(setterPrefix = "with") @Jacksonized -public class LoginRequest { +public class LoginRequest extends CommandRequest { private String email; private String passwordHash; } diff --git a/shared/src/main/java/com/workup/shared/commands/users/responses/AuthenticationResponse.java b/shared/src/main/java/com/workup/shared/commands/users/responses/AuthenticationResponse.java index 36ff0bd8..570f9a6a 100644 --- a/shared/src/main/java/com/workup/shared/commands/users/responses/AuthenticationResponse.java +++ b/shared/src/main/java/com/workup/shared/commands/users/responses/AuthenticationResponse.java @@ -1,5 +1,6 @@ package com.workup.shared.commands.users.responses; +import com.workup.shared.commands.CommandResponse; import com.workup.shared.enums.users.UserType; import lombok.Getter; import lombok.experimental.SuperBuilder; @@ -8,7 +9,7 @@ @Getter @SuperBuilder(setterPrefix = "with") @Jacksonized -public class AuthenticationResponse { +public class AuthenticationResponse extends CommandResponse { private String email; private UserType userType; } From 2c23e553aa7fa0b8c1c187d01d5d1b11e1d868fe Mon Sep 17 00:00:00 2001 From: Akram-Fahim Date: Mon, 29 Apr 2024 13:19:46 +0300 Subject: [PATCH 42/43] Removed the success boolean as suggested by @Ahmad45123 Signed-off-by: Akram-Fahim --- .../shared/commands/users/responses/SignUpAndInResponse.java | 1 - 1 file changed, 1 deletion(-) diff --git a/shared/src/main/java/com/workup/shared/commands/users/responses/SignUpAndInResponse.java b/shared/src/main/java/com/workup/shared/commands/users/responses/SignUpAndInResponse.java index 48902472..488ed021 100644 --- a/shared/src/main/java/com/workup/shared/commands/users/responses/SignUpAndInResponse.java +++ b/shared/src/main/java/com/workup/shared/commands/users/responses/SignUpAndInResponse.java @@ -9,6 +9,5 @@ @SuperBuilder(setterPrefix = "with") @Jacksonized public class SignUpAndInResponse extends CommandResponse { - boolean success; String authToken; } From 07587e8c645f587559b1f65099672a2964d3f132 Mon Sep 17 00:00:00 2001 From: Akram-Fahim Date: Wed, 1 May 2024 11:23:54 +0300 Subject: [PATCH 43/43] Addressed Noureldin's comments Signed-off-by: Akram-Fahim --- .../shared/commands/users/requests/ClientRegisterRequest.java | 2 +- .../commands/users/requests/FreelancerRegisterRequest.java | 2 +- .../com/workup/shared/commands/users/requests/LoginRequest.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/ClientRegisterRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/ClientRegisterRequest.java index 46140c68..b9371443 100644 --- a/shared/src/main/java/com/workup/shared/commands/users/requests/ClientRegisterRequest.java +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/ClientRegisterRequest.java @@ -10,7 +10,7 @@ @Jacksonized public class ClientRegisterRequest extends CommandRequest { private String email; - private String passwordHash; + private String password; private String clientName; private String industry; private String city; diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerRegisterRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerRegisterRequest.java index 6f2875ac..73fbe1de 100644 --- a/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerRegisterRequest.java +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/FreelancerRegisterRequest.java @@ -11,7 +11,7 @@ @Jacksonized public class FreelancerRegisterRequest extends CommandRequest { private String email; - private String passwordHash; + private String password; private String fullName; private String jobTitle; private String city; diff --git a/shared/src/main/java/com/workup/shared/commands/users/requests/LoginRequest.java b/shared/src/main/java/com/workup/shared/commands/users/requests/LoginRequest.java index d8f446e9..ed7fc438 100644 --- a/shared/src/main/java/com/workup/shared/commands/users/requests/LoginRequest.java +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/LoginRequest.java @@ -10,5 +10,5 @@ @Jacksonized public class LoginRequest extends CommandRequest { private String email; - private String passwordHash; + private String password; }