-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/Daggerpov/Spawn-App-Back-End …
…into jwt # Conflicts: # src/main/java/com/danielagapov/spawn/Repositories/IUserRepository.java # src/main/java/com/danielagapov/spawn/Services/OAuth/OAuthService.java # src/main/java/com/danielagapov/spawn/Services/User/IUserService.java # src/main/java/com/danielagapov/spawn/Services/User/UserService.java
- Loading branch information
Showing
43 changed files
with
2,585 additions
and
587 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Spring Boot Syntax Check (Maven) | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '17' | ||
|
||
- name: Cache Maven dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.m2 | ||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: ${{ runner.os }}-maven- | ||
|
||
- name: Compile the project (syntax check) | ||
run: mvn clean compile -DskipTests | ||
|
||
- name: Compile tests (syntax check for test files) | ||
run: mvn test-compile -DskipTests | ||
|
||
- name: Run test suite (but allow failures) | ||
run: mvn test || true |
70 changes: 70 additions & 0 deletions
70
src/main/java/com/danielagapov/spawn/Controllers/BetaAccessSignUpController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package com.danielagapov.spawn.Controllers; | ||
|
||
import com.danielagapov.spawn.DTOs.BetaAccessSignUpDTO; | ||
import com.danielagapov.spawn.Exceptions.Base.BaseNotFoundException; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.*; | ||
import com.danielagapov.spawn.Services.BetaAccessSignUp.IBetaAccessSignUpService; | ||
|
||
import java.util.List; | ||
|
||
@RestController() | ||
@RequestMapping("api/v1/betaAccessSignUp") | ||
public class BetaAccessSignUpController { | ||
private final IBetaAccessSignUpService service; | ||
|
||
public BetaAccessSignUpController(IBetaAccessSignUpService service) { | ||
this.service = service; | ||
} | ||
|
||
// full path: /api/v1/betaAccessSignUp/emails | ||
|
||
/** | ||
* Use case: when we'll want to send out emails for the beta access | ||
*/ | ||
@GetMapping("emails") | ||
public ResponseEntity<List<String>> getAllEmails() { | ||
try { | ||
return new ResponseEntity<>(service.getAllEmails(), HttpStatus.OK); | ||
} catch (BaseNotFoundException e) { | ||
return new ResponseEntity<>(HttpStatus.NOT_FOUND); | ||
} catch (Exception e) { | ||
return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR); | ||
} | ||
} | ||
|
||
// full path: /api/v1/betaAccessSignUp/ | ||
|
||
/** | ||
* @return returns all signed-up users, for our own internal reference, | ||
* without having to check the database | ||
*/ | ||
@GetMapping | ||
public ResponseEntity<List<BetaAccessSignUpDTO>> getAllRecords() { | ||
try { | ||
return new ResponseEntity<>(service.getAllBetaAccessSignUpRecords(), HttpStatus.OK); | ||
} catch (BaseNotFoundException e) { | ||
return new ResponseEntity<>(HttpStatus.NOT_FOUND); | ||
} catch (Exception e) { | ||
return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR); | ||
} | ||
} | ||
|
||
// full path: /api/v1/betaAccessSignUp | ||
|
||
/** | ||
* Sign-up endpoint for creating a new record | ||
* @param dto constructed via front-end form submission | ||
* @return back the DTO after being persisted into our database if successful. | ||
* Otherwise, we'll throw a 500 (INTERNAL_SERVER_ERROR). | ||
*/ | ||
@PostMapping | ||
public ResponseEntity<BetaAccessSignUpDTO> signUp(@RequestBody BetaAccessSignUpDTO dto) { | ||
try { | ||
return new ResponseEntity<>(service.signUp(dto), HttpStatus.CREATED); | ||
} catch (Exception e) { | ||
return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/main/java/com/danielagapov/spawn/DTOs/BetaAccessSignUpDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.danielagapov.spawn.DTOs; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
|
||
import java.io.Serializable; | ||
import java.time.OffsetDateTime; | ||
import java.util.UUID; | ||
|
||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Getter | ||
@Setter | ||
public class BetaAccessSignUpDTO implements Serializable { | ||
private UUID id; | ||
private String email; | ||
private String firstName; | ||
private String lastName; | ||
private OffsetDateTime signedUpAt; | ||
private String additionalComments; | ||
private String instagramUsername; | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/com/danielagapov/spawn/DTOs/FullFriendRequestDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.danielagapov.spawn.DTOs; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
|
||
import java.io.Serializable; | ||
import java.util.UUID; | ||
|
||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Getter | ||
@Setter | ||
public class FullFriendRequestDTO implements Serializable { | ||
UUID id; | ||
FullUserDTO senderUser; | ||
FullUserDTO receiverUser; | ||
} |
2 changes: 1 addition & 1 deletion
2
...lagapov/spawn/Helpers/Logger/ILogger.java → ...apov/spawn/Exceptions/Logger/ILogger.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...elagapov/spawn/Helpers/Logger/Logger.java → ...gapov/spawn/Exceptions/Logger/Logger.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/main/java/com/danielagapov/spawn/Mappers/BetaAccessSignUpMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.danielagapov.spawn.Mappers; | ||
|
||
import com.danielagapov.spawn.DTOs.BetaAccessSignUpDTO; | ||
import com.danielagapov.spawn.Models.BetaAccessSignUp; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
public class BetaAccessSignUpMapper { | ||
|
||
public static BetaAccessSignUpDTO toDTO(BetaAccessSignUp entity) { | ||
return new BetaAccessSignUpDTO( | ||
entity.getId(), | ||
entity.getEmail(), | ||
entity.getFirstName(), | ||
entity.getLastName(), | ||
entity.getSignedUpAt(), | ||
entity.getAdditionalComments(), | ||
entity.getInstagramUsername() | ||
); | ||
} | ||
|
||
public static BetaAccessSignUp toEntity(BetaAccessSignUpDTO dto) { | ||
return new BetaAccessSignUp( | ||
dto.getId(), | ||
dto.getEmail(), | ||
dto.getFirstName(), | ||
dto.getLastName(), | ||
dto.getSignedUpAt(), | ||
dto.getAdditionalComments(), | ||
dto.getInstagramUsername() | ||
); | ||
} | ||
|
||
public static List<BetaAccessSignUpDTO> toDTOList(List<BetaAccessSignUp> entities) { | ||
return entities.stream() | ||
.map(BetaAccessSignUpMapper::toDTO) | ||
.collect(Collectors.toList()); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
src/main/java/com/danielagapov/spawn/Models/BetaAccessSignUp.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.danielagapov.spawn.Models; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
|
||
import java.io.Serializable; | ||
import java.time.OffsetDateTime; | ||
import java.util.UUID; | ||
|
||
@Entity | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Getter | ||
@Setter | ||
public class BetaAccessSignUp implements Serializable { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.AUTO) | ||
private UUID id; | ||
private String email; | ||
private String firstName; | ||
private String lastName; | ||
private OffsetDateTime signedUpAt; | ||
private String additionalComments; | ||
private String instagramUsername; | ||
|
||
@PrePersist | ||
public void prePersist() { | ||
// this happens upon persistence to our database in `BetaAccessSignUpService::signUp()` | ||
if (this.signedUpAt == null) { | ||
this.signedUpAt = OffsetDateTime.now(); | ||
} | ||
} | ||
} |
2 changes: 0 additions & 2 deletions
2
src/main/java/com/danielagapov/spawn/Models/ChatMessageLikes.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
src/main/java/com/danielagapov/spawn/Models/UserIdExternalIdMap.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.