ch prefix

This commit is contained in:
2026-08-18 00:59:32 +05:00
parent dbb6f7bda9
commit 25e5068c8b
2446 changed files with 393356 additions and 455 deletions

View File

@@ -30,7 +30,7 @@ var sortColumns = map[string]string{
func (r repository) GetAllData(ctx context.Context, params listing.Params) (static.DataStaticDTO, error) {
ns := []static.StaticDTO{}
ns := []static.StaticListItemDTO{}
var (
dt static.DataStaticDTO
err error
@@ -40,16 +40,16 @@ func (r repository) GetAllData(ctx context.Context, params listing.Params) (stat
where := ""
args := []interface{}{}
if params.Search != "" {
where = ` where title::text ILIKE $1 or content_tm ILIKE $1 or content_ru ILIKE $1 or content_en ILIKE $1 `
where = ` where title::text ILIKE $1 `
args = append(args, params.SearchPattern())
}
qC := `select count(*) from static` + where + `;`
r.client.QueryRow(ctx, qC, args...).Scan(&dt.Count)
// List: skip content_* (large HTML). Full body is loaded via GetData.
q := ` select
id, logo, title,
content_tm, content_ru, content_en,
created_at
from static` +
where +
@@ -68,10 +68,9 @@ func (r repository) GetAllData(ctx context.Context, params listing.Params) (stat
defer rows.Close()
for rows.Next() {
var n static.StaticDTO
var n static.StaticListItemDTO
errN := rows.Scan(
&n.Id, &n.Logo, &n.Title,
&n.ContentTm, &n.ContentRu, &n.ContentEn,
&n.CreatedAt,
)
if errN != nil {

View File

@@ -3,8 +3,8 @@ package static
import "time"
type DataStaticDTO struct {
Statics []StaticDTO `json:"statics"`
Count int `json:"count"`
Statics []StaticListItemDTO `json:"statics"`
Count int `json:"count"`
}
type Language struct {
@@ -13,6 +13,14 @@ type Language struct {
En string `json:"en"`
}
// StaticListItemDTO is the list payload — no content (loaded via GetData).
type StaticListItemDTO struct {
Id int `json:"Id"`
Logo string `json:"logo"`
Title Language `json:"title"`
CreatedAt time.Time `json:"createdAt"`
}
type StaticDTO struct {
Id int `json:"Id"`
Logo string `json:"logo"`