mirror of
https://github.com/yanislav-igonin/micrach
synced 2025-07-01 17:01:14 +03:00
wip on threads count check
This commit is contained in:
parent
bbed93965d
commit
5cb1584a42
@ -12,6 +12,7 @@ import (
|
||||
"github.com/dchest/captcha"
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
Config "micrach/config"
|
||||
Db "micrach/db"
|
||||
Repositories "micrach/repositories"
|
||||
Utils "micrach/utils"
|
||||
@ -133,6 +134,17 @@ func CreateThread(c *gin.Context) {
|
||||
}
|
||||
defer conn.Release()
|
||||
|
||||
threadsCount, err := Repositories.Posts.GetCount()
|
||||
if err != nil {
|
||||
log.Println("error:", err)
|
||||
c.HTML(http.StatusInternalServerError, "500.html", nil)
|
||||
return
|
||||
}
|
||||
if threadsCount >= Config.App.ThreadsMaxCount {
|
||||
// получить дату последнего неархивируемого треда
|
||||
// сделать SET для тредов старше этой даты
|
||||
}
|
||||
|
||||
tx, err := conn.Begin(context.TODO())
|
||||
if err != nil {
|
||||
log.Println("error:", err)
|
||||
|
Loading…
Reference in New Issue
Block a user