1
0

test delete

This commit is contained in:
2023-05-01 23:00:17 +09:00
parent a0ac2438ed
commit 2883ab052c
22 changed files with 756 additions and 72 deletions

View File

@ -1,5 +1,5 @@
#!/bin/zsh
echo old_id old_did new_name
echo old_id new_id
host=https://api.syui.ai
pass=`cat ~/.config/atr/api_card.json|jq -r .password`
if [ -z "$1" ];then
@ -8,17 +8,11 @@ fi
if [ -z "$2" ];then
exit
fi
if [ -z "$3" ];then
exit
fi
if [ -z "$4" ];then
exit
fi
id=$1
data=`curl -sL "$host/users/$id/card?itemsPerPage=2550"`
echo $data
id_n=$4
id_n=$2
echo $id_n
read
@ -32,4 +26,3 @@ do
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
done

12
tmp/card_account_delete.zsh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/zsh
echo id
host=https://api.syui.ai
token=`cat ~/.config/atr/api_card.json|jq -r .token`
pass=`cat ~/.config/atr/api_card.json|jq -r .pass`
if [ -z "$1" ];then
exit
fi
id=$1
curl -X PATCH -H "Content-Type: application/json" -d "{\"delete\":true,\"token\":\"$token\"}" -s $host/users/$id

View File

@ -0,0 +1,27 @@
#!/bin/zsh
pass=`cat ~/.config/atr/api_card.json|jq -r .password`
d=${0:a:h}
f=$d/t.txt
if [ -z "$1" ];then
exit
fi
if [ ! -f $f ];then
echo $f
exit
fi
id=$1
n=`cat $f|wc -l`
for ((i=1;i<=$n;i++))
do
card=`cat $d/t.txt|awk "NR==$i"`
echo $card
read
curl -X DELETE -H "Content-Type: application/json" -d "{'owner':\"$id\"}" https://api.syui.ai/cards/$card
done
rm $d/t.txt

20
tmp/card_did_change.zsh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/zsh
echo id
host=https://api.syui.ai
token=`cat ~/.config/atr/api_card.json|jq -r .token`
echo $token
pass=`cat ~/.config/atr/api_card.json|jq -r .pass`
if [ -z "$1" ];then
echo 1 : id
exit
fi
if [ -z "$2" ];then
echo 2 : did
exit
fi
id=$1
did=$2
id=$1
curl -X PATCH -H "Content-Type: application/json" -d "{\"did\":\"$did\",\"token\":\"$token\"}" -s $host/users/$id

View File

@ -459,7 +459,7 @@ func decodeListCardParams(args [0]string, r *http.Request) (params ListCardParam
MinSet: true,
Min: 1,
MaxSet: true,
Max: 3000,
Max: 3500,
MinExclusive: false,
MaxExclusive: false,
MultipleOfSet: false,
@ -624,7 +624,7 @@ func decodeListGroupParams(args [0]string, r *http.Request) (params ListGroupPar
MinSet: true,
Min: 1,
MaxSet: true,
Max: 3000,
Max: 3500,
MinExclusive: false,
MaxExclusive: false,
MultipleOfSet: false,
@ -956,7 +956,7 @@ func decodeListUserParams(args [0]string, r *http.Request) (params ListUserParam
MinSet: true,
Min: 1,
MaxSet: true,
Max: 3000,
Max: 3500,
MinExclusive: false,
MaxExclusive: false,
MultipleOfSet: false,

View File

@ -160,6 +160,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):
@ -543,6 +544,12 @@ func (h *OgentHandler) UpdateUser(ctx context.Context, req *UpdateUserReq, param
if v == token {
b.SetToken(v)
// Add all fields.
if v, ok := req.Did.Get(); ok {
b.SetDid(v)
}
if v, ok := req.Delete.Get(); ok {
b.SetDelete(v)
}
if v, ok := req.UpdatedAt.Get(); ok {
b.SetUpdatedAt(v)
}