correct wrong sql query
This commit is contained in:
parent
be6413aed8
commit
e050ae9669
4 changed files with 6 additions and 9 deletions
|
@ -36,13 +36,13 @@ const Panel = () => {
|
||||||
if ((val.status == 401 || val.status == 400) && await val.text() == "missing or malformvald JWT") {
|
if ((val.status == 401 || val.status == 400) && await val.text() == "missing or malformvald JWT") {
|
||||||
window.location.href = "/admin/login"
|
window.location.href = "/admin/login"
|
||||||
} else if (val.status == 200) {
|
} else if (val.status == 200) {
|
||||||
setPosts((await val.json() as Array<Object>).map(post => POST.parse(post)).filter(e => verifyli.findIndex(x => x.id == e.id) == -1))
|
setPosts((await val.json() as Array<Object>).map(post => POST.parse(post)).filter(e => verifyli.findIndex(x => x.post == e.id) == -1))
|
||||||
}
|
}
|
||||||
}).finally(() => { setLoading(false) })
|
}).finally(() => { setLoading(false) })
|
||||||
}
|
}
|
||||||
|
|
||||||
const verify = (check: boolean, post: number) => {
|
const verify = (check: boolean, post: number) => {
|
||||||
setVerifyli([...verifyli, { ck: check, id: post }])
|
setVerifyli([...verifyli, { check: check, post: post }])
|
||||||
setPosts(posts.filter(v => v.id != post))
|
setPosts(posts.filter(v => v.id != post))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ const Panel = () => {
|
||||||
<div className="grid grid-cols-1 md:grid-cols-3 border-3 border-stone-400 rounded w-[80dvw] text-white gap-3 overflow-scroll">
|
<div className="grid grid-cols-1 md:grid-cols-3 border-3 border-stone-400 rounded w-[80dvw] text-white gap-3 overflow-scroll">
|
||||||
{posts.length > 0 ? posts.map(post => {
|
{posts.length > 0 ? posts.map(post => {
|
||||||
return (<div key={post.id} className="border rounded h-fit">
|
return (<div key={post.id} className="border rounded h-fit">
|
||||||
<p>
|
<p className="break-all">
|
||||||
{post.content}
|
{post.content}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
|
@ -130,7 +130,7 @@ func (q *Queries) AdminLoginGetTOTP(ctx context.Context, arg AdminLoginGetTOTPPa
|
||||||
}
|
}
|
||||||
|
|
||||||
const adminUpdateImage = `-- name: AdminUpdateImage :exec
|
const adminUpdateImage = `-- name: AdminUpdateImage :exec
|
||||||
UPDATE media SET visible = false WHERE post_id=$1
|
UPDATE media SET visible = true WHERE post_id=$1
|
||||||
`
|
`
|
||||||
|
|
||||||
func (q *Queries) AdminUpdateImage(ctx context.Context, postID pgtype.Int4) error {
|
func (q *Queries) AdminUpdateImage(ctx context.Context, postID pgtype.Int4) error {
|
||||||
|
|
|
@ -37,10 +37,7 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
app := fiber.New(fiber.Config{Prefork: internal.PREFORK})
|
app := fiber.New(fiber.Config{Prefork: internal.PREFORK})
|
||||||
|
app.Static("/", "./static/webpage/")
|
||||||
app.Get("/", func(c *fiber.Ctx) error {
|
|
||||||
return c.SendString("Hello, World!")
|
|
||||||
})
|
|
||||||
|
|
||||||
app.Use(limiter.New(limiter.Config{
|
app.Use(limiter.New(limiter.Config{
|
||||||
Next: func(c *fiber.Ctx) bool {
|
Next: func(c *fiber.Ctx) bool {
|
||||||
|
|
|
@ -73,7 +73,7 @@ UPDATE posts SET phase = $1 WHERE id=$2 AND phase = 'pending' RETURNING id;
|
||||||
UPDATE posts SET phase = $1 WHERE id=$2 AND (phase = 'pending' OR phase = 'rejected') RETURNING id;
|
UPDATE posts SET phase = $1 WHERE id=$2 AND (phase = 'pending' OR phase = 'rejected') RETURNING id;
|
||||||
|
|
||||||
-- name: AdminUpdateImage :exec
|
-- name: AdminUpdateImage :exec
|
||||||
UPDATE media SET visible = false WHERE post_id=$1;
|
UPDATE media SET visible = true WHERE post_id=$1;
|
||||||
|
|
||||||
-- name: AdminLoginGetTOTP :one
|
-- name: AdminLoginGetTOTP :one
|
||||||
SELECT totp, super FROM admin WHERE username = $1 AND password = $2;
|
SELECT totp, super FROM admin WHERE username = $1 AND password = $2;
|
||||||
|
|
Loading…
Add table
Reference in a new issue