1
0

test delete

This commit is contained in:
syui 2023-07-01 18:45:06 +09:00
parent e9516ac4cd
commit 53f275cbb3
Signed by: syui
GPG Key ID: 5417CFEBAD92DF56
5 changed files with 18 additions and 20 deletions

View File

@ -79,7 +79,7 @@ var (
{Name: "ten_post", Type: field.TypeString, Nullable: true}, {Name: "ten_post", Type: field.TypeString, Nullable: true},
{Name: "ten_get", Type: field.TypeString, Nullable: true}, {Name: "ten_get", Type: field.TypeString, Nullable: true},
{Name: "ten_at", Type: field.TypeTime, 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}, {Name: "group_users", Type: field.TypeInt, Nullable: true},
} }
// UsersTable holds the schema information for the "users" table. // UsersTable holds the schema information for the "users" table.

View File

@ -170,7 +170,7 @@ func (h *OgentHandler) UpdateCard(ctx context.Context, req *UpdateCardReq, param
// DeleteCard handles DELETE /cards/{id} requests. // DeleteCard handles DELETE /cards/{id} requests.
func (h *OgentHandler) DeleteCard(ctx context.Context, params DeleteCardParams) (DeleteCardRes, error) { 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 { if err != nil {
switch { switch {
case ent.IsNotFound(err): case ent.IsNotFound(err):
@ -711,7 +711,7 @@ func (h *OgentHandler) UpdateUser(ctx context.Context, req *UpdateUserReq, param
// DeleteUser handles DELETE /users/{id} requests. // DeleteUser handles DELETE /users/{id} requests.
func (h *OgentHandler) DeleteUser(ctx context.Context, params DeleteUserParams) (DeleteUserRes, error) { 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 { if err != nil {
switch { switch {
case ent.IsNotFound(err): case ent.IsNotFound(err):

View File

@ -831,7 +831,6 @@
} }
}, },
"required": [ "required": [
"username",
"password" "password"
] ]
} }
@ -967,6 +966,9 @@
"schema": { "schema": {
"type": "object", "type": "object",
"properties": { "properties": {
"username": {
"type": "string"
},
"did": { "did": {
"type": "string" "type": "string"
}, },
@ -1403,8 +1405,7 @@
} }
}, },
"required": [ "required": [
"id", "id"
"username"
] ]
}, },
"Group": { "Group": {
@ -1572,8 +1573,7 @@
} }
}, },
"required": [ "required": [
"id", "id"
"username"
] ]
}, },
"User": { "User": {
@ -1669,7 +1669,6 @@
}, },
"required": [ "required": [
"id", "id",
"username",
"password" "password"
] ]
}, },
@ -1753,8 +1752,7 @@
} }
}, },
"required": [ "required": [
"id", "id"
"username"
] ]
}, },
"UserList": { "UserList": {
@ -1837,8 +1835,7 @@
} }
}, },
"required": [ "required": [
"id", "id"
"username"
] ]
}, },
"UserRead": { "UserRead": {
@ -1921,8 +1918,7 @@
} }
}, },
"required": [ "required": [
"id", "id"
"username"
] ]
}, },
"UserUpdate": { "UserUpdate": {
@ -2005,8 +2001,7 @@
} }
}, },
"required": [ "required": [
"id", "id"
"username"
] ]
}, },
"User_CardList": { "User_CardList": {

View File

@ -9,6 +9,8 @@ if [ -z "$2" ];then
exit exit
fi fi
echo old-id new-id
id=$1 id=$1
data=`curl -sL "$host/users/$id/card?itemsPerPage=2550"` data=`curl -sL "$host/users/$id/card?itemsPerPage=2550"`
echo $data echo $data
@ -24,5 +26,6 @@ do
card=`echo $data|jq -r ".[$i].card"` card=`echo $data|jq -r ".[$i].card"`
s=`echo $data|jq -r ".[$i].status"` s=`echo $data|jq -r ".[$i].status"`
cp=`echo $data|jq -r ".[$i].cp"` 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 done

View File

@ -170,7 +170,7 @@ func (h *OgentHandler) UpdateCard(ctx context.Context, req *UpdateCardReq, param
// DeleteCard handles DELETE /cards/{id} requests. // DeleteCard handles DELETE /cards/{id} requests.
func (h *OgentHandler) DeleteCard(ctx context.Context, params DeleteCardParams) (DeleteCardRes, error) { 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 { if err != nil {
switch { switch {
case ent.IsNotFound(err): case ent.IsNotFound(err):
@ -711,7 +711,7 @@ func (h *OgentHandler) UpdateUser(ctx context.Context, req *UpdateUserReq, param
// DeleteUser handles DELETE /users/{id} requests. // DeleteUser handles DELETE /users/{id} requests.
func (h *OgentHandler) DeleteUser(ctx context.Context, params DeleteUserParams) (DeleteUserRes, error) { 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 { if err != nil {
switch { switch {
case ent.IsNotFound(err): case ent.IsNotFound(err):