test token
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
host=https://api.syui.ai
|
||||
api=localhost:8080
|
||||
|
||||
host_users="$host/users?itemsPerPage=255"
|
||||
host_users="$host/users?itemsPerPage=2550"
|
||||
d=${0:a:h}
|
||||
dd=${0:a:h:h}
|
||||
pass=`cat $dd/token.json|jq -r .password`
|
||||
@ -43,22 +43,14 @@ do
|
||||
|
||||
name=`echo $data|jq ".[$i]"|jq -r .username`
|
||||
id=`echo $data|jq ".[$i]"|jq -r .id`
|
||||
if [ "$1" = "-s" ];then
|
||||
did
|
||||
else
|
||||
did=`cat $d/user.json|jq -r ".[]|select(.name == \"$name\")|.did"`
|
||||
fi
|
||||
did=`echo $data|jq ".[$i]"|jq -r .did`
|
||||
|
||||
echo "{\"username\":\"$name\", \"password\":\"$pass\",\"did\":\"$did\"} localhost:8080/users"
|
||||
#if [ "$did" = "null" ];then
|
||||
# echo "{\"username\":\"$name\", \"password\":\"$pass\",\"did\":\"$did\"} localhost:8080/users"
|
||||
#else
|
||||
# echo "{\"username\":\"$name\", \"password\":\"$pass\"} localhost:8080/users"
|
||||
#fi
|
||||
if [ "$1" = "-a" ];then
|
||||
l_users
|
||||
fi
|
||||
|
||||
data_card=`curl -sL "$host/users/$id/card?itemsPerPage=255"`
|
||||
data_card=`curl -sL "$host/users/$id/card?itemsPerPage=2550"`
|
||||
nn=`echo $data_card|jq length`
|
||||
nn=$((nn - 1))
|
||||
|
||||
|
@ -459,7 +459,7 @@ func decodeListCardParams(args [0]string, r *http.Request) (params ListCardParam
|
||||
MinSet: true,
|
||||
Min: 1,
|
||||
MaxSet: true,
|
||||
Max: 25500,
|
||||
Max: 3000,
|
||||
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: 2550,
|
||||
Max: 3000,
|
||||
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: 2550,
|
||||
Max: 3000,
|
||||
MinExclusive: false,
|
||||
MaxExclusive: false,
|
||||
MultipleOfSet: false,
|
||||
|
@ -16,6 +16,8 @@ import (
|
||||
)
|
||||
|
||||
var password = os.Getenv("PASS")
|
||||
var token = os.Getenv("TOKEN")
|
||||
|
||||
var zero = "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||
// OgentHandler implements the ogen generated Handler interface and uses Ent as data layer.
|
||||
type OgentHandler struct {
|
||||
@ -536,19 +538,26 @@ func (h *OgentHandler) ReadUser(ctx context.Context, params ReadUserParams) (Rea
|
||||
// UpdateUser handles PATCH /users/{id} requests.
|
||||
func (h *OgentHandler) UpdateUser(ctx context.Context, req *UpdateUserReq, params UpdateUserParams) (UpdateUserRes, error) {
|
||||
b := h.client.User.UpdateOneID(params.ID)
|
||||
// Add all fields.
|
||||
if v, ok := req.UpdatedAt.Get(); ok {
|
||||
b.SetUpdatedAt(v)
|
||||
|
||||
if v, ok := req.Token.Get(); ok {
|
||||
if v == token {
|
||||
b.SetToken(v)
|
||||
// Add all fields.
|
||||
if v, ok := req.UpdatedAt.Get(); ok {
|
||||
b.SetUpdatedAt(v)
|
||||
}
|
||||
if v, ok := req.Next.Get(); ok {
|
||||
b.SetNext(v)
|
||||
}
|
||||
// Add all edges.
|
||||
if req.Card != nil {
|
||||
b.ClearCard().AddCardIDs(req.Card...)
|
||||
}
|
||||
// Persist to storage.
|
||||
}
|
||||
}
|
||||
if v, ok := req.Next.Get(); ok {
|
||||
b.SetNext(v)
|
||||
}
|
||||
// Add all edges.
|
||||
if req.Card != nil {
|
||||
b.ClearCard().AddCardIDs(req.Card...)
|
||||
}
|
||||
// Persist to storage.
|
||||
e, err := b.Save(ctx)
|
||||
|
||||
if err != nil {
|
||||
switch {
|
||||
case ent.IsNotFound(err):
|
||||
|
Reference in New Issue
Block a user