forked from eclipse-tractusx/managed-identity-wallet
-
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.
Create wallet API skeleton for review ref: eclipse-tractusx#1
- Loading branch information
1 parent
d238a8f
commit e1345f7
Showing
16 changed files
with
585 additions
and
7 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
springCloudVersion=2022.0.2 | ||
testContainerVersion=1.18.0 | ||
jacocoVersion=0.8.8 | ||
springBootVersion=3.0.6 | ||
springDependencyVersion=1.1.0 | ||
groupName=org.eclipse.tractusx | ||
applicationVersion=0.0.1-SNAPSHOT |
29 changes: 29 additions & 0 deletions
29
...n/java/org/eclipse/tractusx/managedidentitywallets/ManagedIdentityWalletsApplication.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
15 changes: 15 additions & 0 deletions
15
src/main/java/org/eclipse/tractusx/managedidentitywallets/config/RestExceptionHandler.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,15 @@ | ||
/* | ||
* Copyright (c) 2023 | smartSense | ||
*/ | ||
|
||
package org.eclipse.tractusx.managedidentitywallets.config; | ||
|
||
import org.springframework.web.bind.annotation.RestControllerAdvice; | ||
|
||
|
||
/** | ||
* The type Rest exception handler. | ||
*/ | ||
@RestControllerAdvice | ||
public class RestExceptionHandler { | ||
} |
33 changes: 33 additions & 0 deletions
33
src/main/java/org/eclipse/tractusx/managedidentitywallets/constant/RestURI.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,33 @@ | ||
/* | ||
* ******************************************************************************* | ||
* Copyright (c) 2021,2023 Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Apache License, Version 2.0 which is available at | ||
* https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations | ||
* under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* ****************************************************************************** | ||
*/ | ||
|
||
package org.eclipse.tractusx.managedidentitywallets.constant; | ||
|
||
/** | ||
* The type Rest uri. | ||
*/ | ||
public class RestURI { | ||
|
||
/** | ||
* The constant WALLET. | ||
*/ | ||
public static final String WALLET = "/wallet"; | ||
} |
56 changes: 56 additions & 0 deletions
56
src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/WalletController.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,56 @@ | ||
/* | ||
* ******************************************************************************* | ||
* Copyright (c) 2021,2023 Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Apache License, Version 2.0 which is available at | ||
* https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations | ||
* under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* ****************************************************************************** | ||
*/ | ||
|
||
package org.eclipse.tractusx.managedidentitywallets.controller; | ||
|
||
import jakarta.validation.Valid; | ||
import lombok.RequiredArgsConstructor; | ||
import org.eclipse.tractusx.managedidentitywallets.constant.RestURI; | ||
import org.eclipse.tractusx.managedidentitywallets.dao.entity.Wallet; | ||
import org.eclipse.tractusx.managedidentitywallets.dto.CreateWalletRequest; | ||
import org.eclipse.tractusx.managedidentitywallets.service.WalletService; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
/** | ||
* The type Wallet controller. | ||
*/ | ||
@RestController | ||
@RequiredArgsConstructor | ||
public class WalletController { | ||
|
||
private final WalletService service; | ||
|
||
/** | ||
* Create wallet response entity. | ||
* | ||
* @param request the request | ||
* @return the response entity | ||
*/ | ||
@PostMapping(path = RestURI.WALLET, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) | ||
public ResponseEntity<Wallet> createWallet(@Valid @RequestBody CreateWalletRequest request){ | ||
return ResponseEntity.status(HttpStatus.CREATED).body(service.createWallet(request)); | ||
} | ||
} |
62 changes: 62 additions & 0 deletions
62
src/main/java/org/eclipse/tractusx/managedidentitywallets/dao/entity/BaseEntity.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,62 @@ | ||
/* | ||
* ******************************************************************************* | ||
* Copyright (c) 2021,2023 Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Apache License, Version 2.0 which is available at | ||
* https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations | ||
* under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* ****************************************************************************** | ||
*/ | ||
|
||
package org.eclipse.tractusx.managedidentitywallets.dao.entity; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnore; | ||
import jakarta.persistence.Column; | ||
import jakarta.persistence.MappedSuperclass; | ||
import jakarta.persistence.Temporal; | ||
import jakarta.persistence.TemporalType; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
import org.hibernate.annotations.CreationTimestamp; | ||
import org.hibernate.annotations.UpdateTimestamp; | ||
|
||
import java.util.Date; | ||
|
||
/** | ||
* The type Base entity. | ||
*/ | ||
@MappedSuperclass | ||
@Getter | ||
@Setter | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class BaseEntity { | ||
|
||
@JsonIgnore | ||
@CreationTimestamp | ||
@Temporal(value = TemporalType.TIMESTAMP) | ||
@Column(nullable = false) | ||
private Date createdAt; | ||
|
||
@JsonIgnore | ||
@UpdateTimestamp | ||
@Temporal(value = TemporalType.TIMESTAMP) | ||
private Date modifiedAt; | ||
|
||
@JsonIgnore | ||
private String modifiedFrom; | ||
|
||
} |
62 changes: 62 additions & 0 deletions
62
src/main/java/org/eclipse/tractusx/managedidentitywallets/dao/entity/Wallet.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,62 @@ | ||
/* | ||
* ******************************************************************************* | ||
* Copyright (c) 2021,2023 Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Apache License, Version 2.0 which is available at | ||
* https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations | ||
* under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* ****************************************************************************** | ||
*/ | ||
|
||
package org.eclipse.tractusx.managedidentitywallets.dao.entity; | ||
|
||
|
||
import jakarta.persistence.*; | ||
import lombok.*; | ||
|
||
/** | ||
* The type Wallet. | ||
*/ | ||
@Getter | ||
@Setter | ||
@Entity | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Builder | ||
public class Wallet extends BaseEntity{ | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "id", columnDefinition = "serial", nullable = false, unique = true) | ||
private Long id; | ||
|
||
@Column(nullable = false, unique = true) | ||
private String did; | ||
|
||
@Column(nullable = false, unique = true) | ||
private String bpn; | ||
|
||
@Column(nullable = false) | ||
private String algorithm; | ||
|
||
@Column(nullable = false) | ||
private Boolean active; | ||
|
||
@Column(nullable = false) | ||
private Boolean authority; | ||
|
||
@Column(nullable = false) | ||
private String didDocument; | ||
|
||
} |
Oops, something went wrong.