test delete
This commit is contained in:
parent
e9516ac4cd
commit
53f275cbb3
@ -79,7 +79,7 @@ var (
|
||||
{Name: "ten_post", Type: field.TypeString, Nullable: true},
|
||||
{Name: "ten_get", Type: field.TypeString, Nullable: true},
|
||||
{Name: "ten_at", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "next", Type: field.TypeString, Nullable: true, Default: "20230621"},
|
||||
{Name: "next", Type: field.TypeString, Nullable: true, Default: "20230701"},
|
||||
{Name: "group_users", Type: field.TypeInt, Nullable: true},
|
||||
}
|
||||
// UsersTable holds the schema information for the "users" table.
|
||||
|
@ -170,7 +170,7 @@ func (h *OgentHandler) UpdateCard(ctx context.Context, req *UpdateCardReq, param
|
||||
|
||||
// DeleteCard handles DELETE /cards/{id} requests.
|
||||
func (h *OgentHandler) DeleteCard(ctx context.Context, params DeleteCardParams) (DeleteCardRes, error) {
|
||||
err := h.client.Card.DeleteOneID(0).Exec(ctx)
|
||||
err := h.client.Card.DeleteOneID(params.ID).Exec(ctx)
|
||||
if err != nil {
|
||||
switch {
|
||||
case ent.IsNotFound(err):
|
||||
@ -711,7 +711,7 @@ func (h *OgentHandler) UpdateUser(ctx context.Context, req *UpdateUserReq, param
|
||||
|
||||
// DeleteUser handles DELETE /users/{id} requests.
|
||||
func (h *OgentHandler) DeleteUser(ctx context.Context, params DeleteUserParams) (DeleteUserRes, error) {
|
||||
err := h.client.User.DeleteOneID(0).Exec(ctx)
|
||||
err := h.client.User.DeleteOneID(params.ID).Exec(ctx)
|
||||
if err != nil {
|
||||
switch {
|
||||
case ent.IsNotFound(err):
|
||||
|
@ -831,7 +831,6 @@
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"username",
|
||||
"password"
|
||||
]
|
||||
}
|
||||
@ -967,6 +966,9 @@
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"username": {
|
||||
"type": "string"
|
||||
},
|
||||
"did": {
|
||||
"type": "string"
|
||||
},
|
||||
@ -1403,8 +1405,7 @@
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"username"
|
||||
"id"
|
||||
]
|
||||
},
|
||||
"Group": {
|
||||
@ -1572,8 +1573,7 @@
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"username"
|
||||
"id"
|
||||
]
|
||||
},
|
||||
"User": {
|
||||
@ -1669,7 +1669,6 @@
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"username",
|
||||
"password"
|
||||
]
|
||||
},
|
||||
@ -1753,8 +1752,7 @@
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"username"
|
||||
"id"
|
||||
]
|
||||
},
|
||||
"UserList": {
|
||||
@ -1837,8 +1835,7 @@
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"username"
|
||||
"id"
|
||||
]
|
||||
},
|
||||
"UserRead": {
|
||||
@ -1921,8 +1918,7 @@
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"username"
|
||||
"id"
|
||||
]
|
||||
},
|
||||
"UserUpdate": {
|
||||
@ -2005,8 +2001,7 @@
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"username"
|
||||
"id"
|
||||
]
|
||||
},
|
||||
"User_CardList": {
|
||||
|
@ -9,6 +9,8 @@ if [ -z "$2" ];then
|
||||
exit
|
||||
fi
|
||||
|
||||
echo old-id new-id
|
||||
|
||||
id=$1
|
||||
data=`curl -sL "$host/users/$id/card?itemsPerPage=2550"`
|
||||
echo $data
|
||||
@ -24,5 +26,6 @@ do
|
||||
card=`echo $data|jq -r ".[$i].card"`
|
||||
s=`echo $data|jq -r ".[$i].status"`
|
||||
cp=`echo $data|jq -r ".[$i].cp"`
|
||||
curl -X POST -H "Content-Type: application/json" -d "{\"owner\":$id_n,\"card\":$card,\"status\":\"$s\",\"cp\":$cp,\"password\":\"$pass\"}" -sL $host/cards
|
||||
skill=`echo $data|jq -r ".[$i].skill"`
|
||||
curl -X POST -H "Content-Type: application/json" -d "{\"owner\":$id_n,\"card\":$card,\"status\":\"$s\",\"cp\":$cp,\"password\":\"$pass\",\"skill\":\"$skill\"}" -sL $host/cards
|
||||
done
|
||||
|
@ -170,7 +170,7 @@ func (h *OgentHandler) UpdateCard(ctx context.Context, req *UpdateCardReq, param
|
||||
|
||||
// DeleteCard handles DELETE /cards/{id} requests.
|
||||
func (h *OgentHandler) DeleteCard(ctx context.Context, params DeleteCardParams) (DeleteCardRes, error) {
|
||||
err := h.client.Card.DeleteOneID(0).Exec(ctx)
|
||||
err := h.client.Card.DeleteOneID(params.ID).Exec(ctx)
|
||||
if err != nil {
|
||||
switch {
|
||||
case ent.IsNotFound(err):
|
||||
@ -711,7 +711,7 @@ func (h *OgentHandler) UpdateUser(ctx context.Context, req *UpdateUserReq, param
|
||||
|
||||
// DeleteUser handles DELETE /users/{id} requests.
|
||||
func (h *OgentHandler) DeleteUser(ctx context.Context, params DeleteUserParams) (DeleteUserRes, error) {
|
||||
err := h.client.User.DeleteOneID(0).Exec(ctx)
|
||||
err := h.client.User.DeleteOneID(params.ID).Exec(ctx)
|
||||
if err != nil {
|
||||
switch {
|
||||
case ent.IsNotFound(err):
|
||||
|
Loading…
Reference in New Issue
Block a user