Skip to content

Commit

Permalink
Users Authentication Requests/Responses (#53)
Browse files Browse the repository at this point in the history
* Created Users module, and added FreelancerRegister request and response

* Updated added builder annotation to FreelancerRegisterResponse and removed redundant @nonnull

* Removed the NonNull annotation to make the class compatible with the Builder annotation

* Addressed @Ahmad45123's comments and created a test to verify the serialization process.

* Deleted commented file

Signed-off-by: Akram-Fahim <akramadel2001@gmail.com>

* Revert "Deleted commented file"

This reverts commit f9b11cf.

* Added all required Authentication (register/login) requests and responses

Signed-off-by: Akram-Fahim <akramadel2001@gmail.com>

* Deleted useless file

Signed-off-by: Akram-Fahim <akramadel2001@gmail.com>

* Created Users module, and added FreelancerRegister request and response

* Updated added builder annotation to FreelancerRegisterResponse and removed redundant @nonnull

* Removed the NonNull annotation to make the class compatible with the Builder annotation

* Addressed @Ahmad45123's comments and created a test to verify the serialization process.

* Deleted commented file

Signed-off-by: Akram-Fahim <akramadel2001@gmail.com>

* Revert "Deleted commented file"

This reverts commit f9b11cf.

* Added all required Authentication (register/login) requests and responses

Signed-off-by: Akram-Fahim <akramadel2001@gmail.com>

* Deleted useless file

Signed-off-by: Akram-Fahim <akramadel2001@gmail.com>

* Created Users module, and added FreelancerRegister request and response

* Updated added builder annotation to FreelancerRegisterResponse and removed redundant @nonnull

* Removed the NonNull annotation to make the class compatible with the Builder annotation

* Addressed @Ahmad45123's comments and created a test to verify the serialization process.

* Deleted commented file

Signed-off-by: Akram-Fahim <akramadel2001@gmail.com>

* Revert "Deleted commented file"

This reverts commit f9b11cf.

* Added all required Authentication (register/login) requests and responses

Signed-off-by: Akram-Fahim <akramadel2001@gmail.com>

* Deleted useless file

Signed-off-by: Akram-Fahim <akramadel2001@gmail.com>

* Updated the annotations to match the ones requested by @Ahmad45123

Signed-off-by: Akram-Fahim <akramadel2001@gmail.com>

* Linting

Signed-off-by: Akram-Fahim <akramadel2001@gmail.com>

* Linting

Signed-off-by: Akram-Fahim <akramadel2001@gmail.com>

* Handled Inheritance bug

Signed-off-by: Akram-Fahim <akramadel2001@gmail.com>

* Removed the success boolean as suggested by @Ahmad45123

Signed-off-by: Akram-Fahim <akramadel2001@gmail.com>

* Addressed Noureldin's comments

Signed-off-by: Akram-Fahim <akramadel2001@gmail.com>

* Created Users module, and added FreelancerRegister request and response

* Addressed @Ahmad45123's comments and created a test to verify the serialization process.

* Created Users module, and added FreelancerRegister request and response

* Addressed @Ahmad45123's comments and created a test to verify the serialization process.

* Added all required Authentication (register/login) requests and responses

Signed-off-by: Akram-Fahim <akramadel2001@gmail.com>

* Created Users module, and added FreelancerRegister request and response

* Addressed @Ahmad45123's comments and created a test to verify the serialization process.

* Added all required Authentication (register/login) requests and responses

Signed-off-by: Akram-Fahim <akramadel2001@gmail.com>

* Updated the annotations to match the ones requested by @Ahmad45123

Signed-off-by: Akram-Fahim <akramadel2001@gmail.com>

* Linting

Signed-off-by: Akram-Fahim <akramadel2001@gmail.com>

* Handled Inheritance bug

Signed-off-by: Akram-Fahim <akramadel2001@gmail.com>

* Removed the success boolean as suggested by @Ahmad45123

Signed-off-by: Akram-Fahim <akramadel2001@gmail.com>

* Addressed Noureldin's comments

Signed-off-by: Akram-Fahim <akramadel2001@gmail.com>

---------

Signed-off-by: Akram-Fahim <akramadel2001@gmail.com>
  • Loading branch information
Akram-Fahim authored May 9, 2024
1 parent 332c81a commit ce813b7
Show file tree
Hide file tree
Showing 9 changed files with 83 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//package com.workup.users.requests;
//
//public class FreelancerLoginRequest {
// String email = "";
//
// @NonNull
// @Builder.Default
// String passwordHash = "";
//}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
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;

@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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
@Getter
@SuperBuilder(setterPrefix = "with")
@Jacksonized
public class FreelancerGetPhotoResponse extends CommandResponse {
public String photoLink;
public class SignUpAndInResponse extends CommandResponse {
String authToken;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.workup.shared.enums.users;

public enum UserType {
FREELANCER,
CLIENT
}

0 comments on commit ce813b7

Please sign in to comment.