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) (banner.DataBannerDTO, error) {
ns := []banner.GetBannerDTO{}
ns := []banner.BannerListItemDTO{}
var (
dt banner.DataBannerDTO
err error
@@ -40,16 +40,16 @@ func (r repository) GetAllData(ctx context.Context, params listing.Params) (bann
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 banner` + where + `;`
r.client.QueryRow(ctx, qC, args...).Scan(&dt.Count)
// List: skip content_* (large HTML). Full body is loaded via GetOneData.
q := ` select
id, title,
content_tm, content_ru, content_en,
img, created_at
from banner` +
where +
@@ -68,10 +68,9 @@ func (r repository) GetAllData(ctx context.Context, params listing.Params) (bann
defer rows.Close()
for rows.Next() {
var n banner.GetBannerDTO
var n banner.BannerListItemDTO
errN := rows.Scan(
&n.Id, &n.Title,
&n.ContentTm, &n.ContentRu, &n.ContentEn,
&n.Image, &n.CreatedAt,
)
if errN != nil {

View File

@@ -3,8 +3,8 @@ package banner
import "time"
type DataBannerDTO struct {
Categories []GetBannerDTO `json:"banners"`
Count int `json:"count"`
Categories []BannerListItemDTO `json:"banners"`
Count int `json:"count"`
}
type Language struct {
@@ -13,6 +13,14 @@ type Language struct {
En string `json:"en"`
}
// BannerListItemDTO is the list payload — no content (loaded via GetOne).
type BannerListItemDTO struct {
Id int `json:"Id"`
Title Language `json:"title"`
Image string `json:"imagePath"`
CreatedAt time.Time `json:"createdAt"`
}
type GetBannerDTO struct {
Id int `json:"Id"`
Title Language `json:"title"`