-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: updated entities * chore: Changed postgres version * feat: Changed member joined date to localdate * fix: removed auth call to authelia api * added dtos * started login and auth logic * feat: docker-compose * Added TokenService --------- Co-authored-by: Ivan Farfan <ivanfarfan@ses-miyengar-lab-13.mynetworksettings.com> Co-authored-by: miguel-merlin <mmerlin@stevens.edu>
- Loading branch information
1 parent
af640e7
commit 0e1f38e
Showing
36 changed files
with
1,141 additions
and
596 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 |
---|---|---|
@@ -1,75 +1,39 @@ | ||
plugins { | ||
id 'java' | ||
id 'org.springframework.boot' version '3.2.3' | ||
id 'io.spring.dependency-management' version '1.1.4' | ||
id "com.diffplug.spotless" version "5.16.0" | ||
id 'jacoco' | ||
id 'application' | ||
id 'java' | ||
id 'org.springframework.boot' version '3.2.3' | ||
id 'io.spring.dependency-management' version '1.1.4' | ||
} | ||
|
||
group = 'com.sitblueprint' | ||
version = '0.0.1-SNAPSHOT' | ||
mainClassName = 'com.sitblueprint.admin.BlueprintAdmin' | ||
|
||
java { | ||
sourceCompatibility = '17' | ||
sourceCompatibility = '17' | ||
} | ||
|
||
configurations { | ||
compileOnly { | ||
extendsFrom annotationProcessor | ||
} | ||
compileOnly { | ||
extendsFrom annotationProcessor | ||
} | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
spotless { | ||
// optional: limit format enforcement to just the files changed by this feature branch | ||
// ratchetFrom 'origin/main' | ||
|
||
format 'misc', { | ||
// define the files to apply `misc` to | ||
target '*.gradle', '*.md', '.gitignore' | ||
|
||
// define the steps to apply to those files | ||
trimTrailingWhitespace() | ||
indentWithSpaces(3) // or spaces. Takes an integer argument if you don't like 4 | ||
endWithNewline() | ||
setEncoding('utf-8') | ||
} | ||
java { | ||
eclipse() // I like eclipse formatting over google | ||
// googleJavaFormat('1.11.0').aosp().reflowLongStrings(), this is the other option | ||
} | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation 'org.springframework.boot:spring-boot-starter-data-jpa' | ||
implementation 'org.springframework.boot:spring-boot-starter-web' | ||
implementation 'org.springframework.data:spring-data-rest-hal-explorer' | ||
compileOnly 'org.projectlombok:lombok' | ||
runtimeOnly 'com.h2database:h2' | ||
annotationProcessor 'org.projectlombok:lombok' | ||
testImplementation 'org.springframework.boot:spring-boot-starter-test' | ||
runtimeOnly 'org.postgresql:postgresql:42.2.23' | ||
} | ||
|
||
jacocoTestReport { | ||
dependsOn test | ||
jacocoTestCoverageVerification { | ||
violationRules { | ||
rule { | ||
limit { | ||
minimum = 0.10 | ||
} | ||
} | ||
} | ||
} | ||
implementation 'org.springframework.boot:spring-boot-starter-data-jpa' | ||
implementation 'org.springframework.boot:spring-boot-starter-web' | ||
implementation 'org.springframework.data:spring-data-rest-hal-explorer' | ||
implementation "org.springframework.boot:spring-boot-starter-security" | ||
implementation 'org.hibernate:hibernate-validator:6.0.13.Final' | ||
compileOnly 'org.projectlombok:lombok' | ||
runtimeOnly 'com.h2database:h2' | ||
annotationProcessor 'org.projectlombok:lombok' | ||
testImplementation 'org.springframework.boot:spring-boot-starter-test' | ||
runtimeOnly 'org.postgresql:postgresql:42.2.23' | ||
} | ||
|
||
tasks.named('test') { | ||
useJUnitPlatform() | ||
finalizedBy jacocoTestCoverageVerification | ||
useJUnitPlatform() | ||
} |
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
4 changes: 4 additions & 0 deletions
4
src/main/java/com/sitblueprint/admin/controller/exceptions/ApiError.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
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
66 changes: 66 additions & 0 deletions
66
src/main/java/com/sitblueprint/admin/controller/users/MemberController.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,66 @@ | ||
package com.sitblueprint.admin.controller.users; | ||
|
||
import com.sitblueprint.admin.dtos.member.MemberDTO; | ||
import com.sitblueprint.admin.service.users.MemberService; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import java.util.List; | ||
|
||
@RestController | ||
@RequestMapping("/api/v1/member") | ||
public class MemberController { | ||
|
||
MemberService memberService; | ||
|
||
@Autowired | ||
public MemberController(MemberService memberService) { | ||
this.memberService = memberService; | ||
} | ||
|
||
@GetMapping | ||
public List<MemberDTO> getAllMembers() { | ||
return memberService.getAllMembers(); | ||
} | ||
|
||
@GetMapping("/{memberId}") | ||
public ResponseEntity<?> getMember(@PathVariable("memberId") Long memberId) { | ||
try { | ||
MemberDTO member = memberService.getMemberById(memberId); | ||
return ResponseEntity.ok(member); | ||
} catch (NumberFormatException e) { | ||
return ResponseEntity.badRequest().body("Invalid member id format"); | ||
} | ||
} | ||
|
||
@PostMapping | ||
public MemberDTO createMember(@RequestBody MemberDTO member) { | ||
return memberService.createMember(member); | ||
} | ||
|
||
@PutMapping | ||
public MemberDTO updateMember(@RequestBody MemberDTO member) { | ||
return memberService.updateMember(member); | ||
} | ||
|
||
@DeleteMapping | ||
public void deleteMember(String memberId) { | ||
memberService.deleteMemberById(Long.parseLong(memberId)); | ||
} | ||
|
||
@PostMapping("enable/{memberId}") | ||
public void enableMember(@PathVariable("memberId") String memberId) { | ||
memberService.enableMemberById(Long.parseLong(memberId)); | ||
} | ||
|
||
@PostMapping("disable/{memberId}") | ||
public void disableMember(@PathVariable("memberId") String memberId) { | ||
memberService.disableMemberById(Long.parseLong(memberId)); | ||
} | ||
|
||
@PutMapping("reset_password") | ||
public void resetPassword(@RequestBody String memberId, @RequestBody String newPassword) { | ||
memberService.resetPassword(Long.parseLong(memberId), newPassword); | ||
} | ||
} |
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.