Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
bookstore
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
郭智朋
bookstore
Commits
d7b6dcf4
Commit
d7b6dcf4
authored
Jan 15, 2025
by
guozhipeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
数据库
parent
b29b6d81
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
128 additions
and
9 deletions
+128
-9
requests.http
requests.http
+120
-0
pom.xml
srv/pom.xml
+5
-7
application.yaml
srv/src/main/resources/application.yaml
+3
-2
No files found.
requests.http
0 → 100644
View file @
d7b6dcf4
### Create Order
POST http://localhost:8080/odata/v4/OrdersService/Orders
Content-Type: application/json
{
"items": [
{
"book_ID": "abed2f7a-c50e-4bc5-89fd-9a00a54b4b16",
"amount": 2
}
]
}
### Read Book
GET http://localhost:8080/odata/v4/BooksService/Books(abed2f7a-c50e-4bc5-89fd-9a00a54b4b16)
Accept: application/json
### Create another Order
POST http://localhost:8080/odata/v4/OrdersService/Orders
Content-Type: application/json
{
"items": [
{
"book_ID": "fd0c5fda-8811-4e20-bcff-3a776abc290a",
"amount": 10
}
]
}
### Read Orders
GET http://localhost:8080/odata/v4/OrdersService/Orders
Accept: application/json
### Create Order 不添加验证
POST http://localhost:8080/odata/v4/OrdersService/Orders
Content-Type: application/json
{
"items": [
{
"book_ID": "abed2f7a-c50e-4bc5-89fd-9a00a54b4b16",
"amount": 2
}
]
}
### Create Order 添加验证
POST http://localhost:8080/odata/v4/OrdersService/Orders
Content-Type: application/json
Authorization: Basic authenticated:
{
"items": [
{
"book_ID": "abed2f7a-c50e-4bc5-89fd-9a00a54b4b16",
"amount": 2
}
]
}
### Create Order
POST http://localhost:8080/odata/v4/OrdersService/Orders
Content-Type: application/json
Authorization: Basic klaus:pass_klaus
{
"items": [
{
"book_ID": "abed2f7a-c50e-4bc5-89fd-9a00a54b4b16",
"amount": 2
}
]
}
### Read Products
GET http://localhost:8080/odata/v4/AdminService/Products
Accept: application/json
Authorization: Basic sabine:pass_sabine
### Create Order as Mia
POST http://localhost:8080/odata/v4/OrdersService/Orders
Content-Type: application/json
Authorization: Basic mia:pass_mia
{
"items": [
{
"book_ID": "fd0c5fda-8811-4e20-bcff-3a776abc290a",
"amount": 10
}
]
}
### Read Orders as Klaus 您将看到自己的订单和项目
GET http://localhost:8080/odata/v4/OrdersService/OrderItems
Accept: application/json
Authorization: Basic klaus:pass_klaus
### Read Orders as Sabine (Administrator) 您将看不到任何项目
GET http://localhost:8080/odata/v4/OrdersService/Orders?$expand=items
Accept: application/json
Authorization: Basic sabine:pass_sabine
srv/pom.xml
View file @
d7b6dcf4
...
@@ -39,9 +39,8 @@
...
@@ -39,9 +39,8 @@
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.h2database
</groupId>
<groupId>
com.sap.cds
</groupId>
<artifactId>
h2
</artifactId>
<artifactId>
cds-feature-hana
</artifactId>
<scope>
runtime
</scope>
</dependency>
</dependency>
<dependency>
<dependency>
...
@@ -53,10 +52,10 @@
...
@@ -53,10 +52,10 @@
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-actuator
</artifactId>
<artifactId>
spring-boot-starter-actuator
</artifactId>
</dependency>
</dependency>
<!-- Lombok -->
<dependency>
<dependency>
<groupId>
com.sap.cds
</groupId>
<groupId>
org.projectlombok
</groupId>
<artifactId>
cds-feature-hana
</artifactId>
<artifactId>
lombok
</artifactId>
</dependency>
</dependency>
</dependencies>
</dependencies>
...
@@ -126,7 +125,6 @@
...
@@ -126,7 +125,6 @@
<configuration>
<configuration>
<commands>
<commands>
<command>
build --for java
</command>
<command>
build --for java
</command>
<!--<command>deploy --to h2 --dry --out "${project.basedir}/src/main/resources/schema-h2.sql"</command>-->
</commands>
</commands>
</configuration>
</configuration>
</execution>
</execution>
...
...
srv/src/main/resources/application.yaml
View file @
d7b6dcf4
---
---
spring
:
spring
:
config.activate.on-profile
:
default
config.activate.on-profile
:
default
#sql.init.schema-locations: classpath:schema-h2.sql
cds
:
cds
:
data-source.auto-config.enabled
:
true
index-page.enabled
:
true
datasource
:
auto-config.enabled
:
true
security
:
security
:
mock
:
mock
:
users
:
users
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment