1
0
api/docs/wiki.md

88 lines
1.8 KiB
Markdown
Raw Permalink Normal View History

2024-04-11 16:54:12 +00:00
## build
2023-04-05 06:05:14 +00:00
```sh
2024-04-11 16:54:12 +00:00
./build.zsh
2023-04-05 06:05:14 +00:00
```
2024-04-11 16:54:12 +00:00
## diff
> diff tmp/ogent/ogent.go ent/ogent/ogent.go
```diff
< "os"
---
< var password = os.Getenv("PASS")
< var token = os.Getenv("TOKEN")
---
< if req.Password == password {
< b.SetOwnerID(req.Owner)
< } else {
< b.SetOwnerID(0)
< }
< //b.SetOwnerID(req.Owner)
---
> b.SetOwnerID(req.Owner)
< //if v, ok := req.Owner.Get(); ok {
< // b.SetOwnerID(v)
< //}
< if v, ok := req.Token.Get(); ok {
< if v == token {
< b.SetToken(v)
< if v, ok := req.Owner.Get(); ok {
< b.SetOwnerID(v)
< }
< }
---
< //err := h.client.Card.DeleteOneID(params.ID).Exec(ctx)
< err := h.client.Card.DeleteOneID(0).Exec(ctx)
---
> err := h.client.Ue.DeleteOneID(params.ID).Exec(ctx)
< //b.SetUsername(req.Username)
< if req.Password == password {
< b.SetUsername(req.Username)
< } else {
< b.SetUsername("")
< }
```
2023-04-05 06:05:14 +00:00
2024-04-11 16:54:12 +00:00
## northflank
2023-04-05 06:05:14 +00:00
2024-04-11 16:54:12 +00:00
- ports : http, 8080, dns=api.syui.ai
- env : PASS=xxx, TOKEN=xxx
- cmd-override : /bin/api
- volumes : /app/data
2023-04-05 06:05:14 +00:00
2024-04-11 16:54:12 +00:00
## api
2023-04-05 06:05:14 +00:00
2024-04-11 16:54:12 +00:00
### get
2023-04-05 06:05:14 +00:00
```sh
2024-04-11 16:54:12 +00:00
$ curl -sL $api/users/2
2023-04-05 06:05:14 +00:00
2024-04-11 16:54:12 +00:00
$ curl -sL "$api/users?itemsPerPage=2000"
2023-04-05 06:05:14 +00:00
2024-04-11 16:54:12 +00:00
$ curl -sL "$api/users/$uid/card?itemsPerPage=2550"
```
2023-04-05 06:05:14 +00:00
2024-04-11 16:54:12 +00:00
### post
2023-04-05 06:05:14 +00:00
2024-04-11 16:54:12 +00:00
```sh
$ curl -X POST -H "Content-Type: application/json" -d "{\"username\":\"$name\",\"password\":\"$pass\",\"did\":\"$did\"}" $api/users
2023-04-05 06:05:14 +00:00
2024-04-11 16:54:12 +00:00
$ curl -X POST -H "Content-Type: application/json" -d "{\"owner\":$uid,\"card\":$card,\"status\":\"$s\",\"cp\":$cp,\"password\":\"$pass\"}" $api/cards
```
2023-04-05 06:05:14 +00:00
2024-04-11 16:54:12 +00:00
### patch
2023-04-05 06:05:14 +00:00
```sh
2024-04-11 16:54:12 +00:00
$ curl -X PATCH -H "Content-Type: application/json" -d "{\"author\":\"$username\", \"count\":$count,\"token\":\"$token\"}" $api/cards/$cid
2023-04-05 06:05:14 +00:00
2024-04-11 16:54:12 +00:00
$ curl -X PATCH -H "Content-Type: application/json" -d "{\"model\":true,\"model_limit\": 1,\"token\":\"$token\"}" -s $api/users/$uid
2023-04-05 06:05:14 +00:00
```
2024-04-11 16:54:12 +00:00
### delete
2023-04-05 06:05:14 +00:00
```sh
2024-04-11 16:54:12 +00:00
$ curl -X DELETE -H "Content-Type: application/json" -d "{'owner':\"$uid\"}" $api/cards/$cid
2023-04-05 06:05:14 +00:00
```