-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
455 additions
and
30 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
30 changes: 30 additions & 0 deletions
30
...i-tenant/src/main/java/fr/dossierfacile/api/front/controller/OneTimeSecretController.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,30 @@ | ||
package fr.dossierfacile.api.front.controller; | ||
|
||
import fr.dossierfacile.common.entity.OperationAccessToken; | ||
import fr.dossierfacile.common.service.interfaces.OperationAccessTokenService; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import static org.springframework.http.ResponseEntity.ok; | ||
|
||
@RestController | ||
@RequestMapping("/api/onetimesecret") | ||
@RequiredArgsConstructor | ||
@Slf4j | ||
public class OneTimeSecretController { | ||
private final OperationAccessTokenService operationAccessTokenService; | ||
|
||
@GetMapping(value = "/{token}", produces = MediaType.TEXT_PLAIN_VALUE) | ||
public ResponseEntity<String> displayContent(@PathVariable String token) { | ||
OperationAccessToken operationAccessToken = operationAccessTokenService.findByToken(token); | ||
String content = operationAccessToken.getContent(); | ||
operationAccessTokenService.delete(operationAccessToken); | ||
return ok(content); | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
...tenant/src/main/java/fr/dossierfacile/api/front/dfc/controller/DfcSettingsController.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,42 @@ | ||
package fr.dossierfacile.api.front.dfc.controller; | ||
|
||
import fr.dossierfacile.api.front.aop.annotation.MethodLogTime; | ||
import fr.dossierfacile.api.front.mapper.PartnerSettingsMapper; | ||
import fr.dossierfacile.api.front.model.dfc.PartnerSettings; | ||
import fr.dossierfacile.api.front.security.interfaces.ClientAuthenticationFacade; | ||
import fr.dossierfacile.api.front.service.interfaces.UserApiService; | ||
import fr.dossierfacile.common.entity.UserApi; | ||
import io.swagger.annotations.ApiOperation; | ||
import lombok.AllArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import static org.springframework.http.ResponseEntity.ok; | ||
|
||
@RestController | ||
@AllArgsConstructor | ||
@RequestMapping("/dfc/api/v1/settings") | ||
@Slf4j | ||
@MethodLogTime | ||
public class DfcSettingsController { | ||
private final ClientAuthenticationFacade clientAuthenticationFacade; | ||
private UserApiService userApiService; | ||
private PartnerSettingsMapper partnerSettingsMapper; | ||
|
||
@ApiOperation(value = "Get current partner settings") | ||
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE) | ||
public ResponseEntity<PartnerSettings> get() { | ||
UserApi userApi = clientAuthenticationFacade.getClient(); | ||
return ok(partnerSettingsMapper.toPartnerSettings(userApi)); | ||
} | ||
|
||
@ApiOperation(value = "Update partner settings") | ||
@PatchMapping(produces = MediaType.APPLICATION_JSON_VALUE) | ||
public ResponseEntity<PartnerSettings> update(@RequestBody PartnerSettings settings) { | ||
UserApi userApi = clientAuthenticationFacade.getClient(); | ||
UserApi result = userApiService.update(userApi, settings); | ||
return ok(partnerSettingsMapper.toPartnerSettings(result)); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...ile-api-tenant/src/main/java/fr/dossierfacile/api/front/mapper/PartnerSettingsMapper.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,12 @@ | ||
package fr.dossierfacile.api.front.mapper; | ||
|
||
import fr.dossierfacile.api.front.model.dfc.PartnerSettings; | ||
import fr.dossierfacile.common.entity.UserApi; | ||
import org.mapstruct.Mapper; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@Mapper(componentModel = "spring") | ||
public interface PartnerSettingsMapper { | ||
PartnerSettings toPartnerSettings(UserApi userApi); | ||
} |
18 changes: 18 additions & 0 deletions
18
...facile-api-tenant/src/main/java/fr/dossierfacile/api/front/model/dfc/PartnerSettings.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,18 @@ | ||
package fr.dossierfacile.api.front.model.dfc; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
|
||
@Getter | ||
@Setter | ||
@NoArgsConstructor | ||
public class PartnerSettings { | ||
private String name; | ||
private Integer version; | ||
@JsonProperty("callbackUrl") | ||
private String urlCallback; | ||
@JsonProperty("callbackApiKey") | ||
private String partnerApiKeyCallback; | ||
} |
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
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
Oops, something went wrong.