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..fc381b9c 100644 --- a/services/users/src/test/java/com/workup/users/RequestsAndResponsesTest.java +++ b/services/users/src/test/java/com/workup/users/RequestsAndResponsesTest.java @@ -4,13 +4,20 @@ 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; public class RequestsAndResponsesTest { private static Object[] testObjects = { // all requests/responses to be tested - FreelancerRegisterRequest.builder().build(), FreelancerRegisterResponse.builder().build(), + FreelancerRegisterRequest.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..79d9bbd5 --- /dev/null +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/AuthenticationRequest.java @@ -0,0 +1,13 @@ +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; + +@Getter +@SuperBuilder(setterPrefix = "with") +@Jacksonized +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 new file mode 100644 index 00000000..b9371443 --- /dev/null +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/ClientRegisterRequest.java @@ -0,0 +1,20 @@ +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; + +@Getter +@SuperBuilder(setterPrefix = "with") +@Jacksonized +public class ClientRegisterRequest extends CommandRequest { + private String email; + private String password; + 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/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 = ""; +//} 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..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 @@ -10,10 +10,10 @@ @SuperBuilder(setterPrefix = "with") @Jacksonized 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 password; + 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..ed7fc438 --- /dev/null +++ b/shared/src/main/java/com/workup/shared/commands/users/requests/LoginRequest.java @@ -0,0 +1,14 @@ +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; + +@Getter +@SuperBuilder(setterPrefix = "with") +@Jacksonized +public class LoginRequest extends CommandRequest { + private String email; + private String password; +} 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/AuthenticationResponse.java similarity index 62% 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/AuthenticationResponse.java index 0dfabc7d..570f9a6a 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/AuthenticationResponse.java @@ -1,6 +1,7 @@ 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; import lombok.extern.jackson.Jacksonized; @@ -8,7 +9,7 @@ @Getter @SuperBuilder(setterPrefix = "with") @Jacksonized -public class FreelancerRegisterResponse extends CommandResponse { - public boolean success; - public String authToken; +public class AuthenticationResponse extends CommandResponse { + private String email; + private UserType userType; } 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/SignUpAndInResponse.java similarity index 74% rename from shared/src/main/java/com/workup/shared/commands/users/responses/FreelancerGetPhotoResponse.java rename to shared/src/main/java/com/workup/shared/commands/users/responses/SignUpAndInResponse.java index 819fbc5a..488ed021 100644 --- a/shared/src/main/java/com/workup/shared/commands/users/responses/FreelancerGetPhotoResponse.java +++ b/shared/src/main/java/com/workup/shared/commands/users/responses/SignUpAndInResponse.java @@ -8,6 +8,6 @@ @Getter @SuperBuilder(setterPrefix = "with") @Jacksonized -public class FreelancerGetPhotoResponse extends CommandResponse { - public String photoLink; +public class SignUpAndInResponse extends CommandResponse { + String authToken; } 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 +}