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

View File

@@ -3,8 +3,8 @@ package currency
import "time"
type DataCurrencyDTO struct {
Currencies []CurrencyDTO `json:"currencies"`
Count int `json:"count"`
Currencies []CurrencyListItemDTO `json:"currencies"`
Count int `json:"count"`
}
type Language struct {
@@ -13,6 +13,14 @@ type Language struct {
En string `json:"en"`
}
// CurrencyListItemDTO is the list payload — no content (loaded via GetData).
type CurrencyListItemDTO struct {
Id int `json:"Id"`
Title Language `json:"title"`
Path string `json:"path"`
CreatedAt time.Time `json:"createdAt"`
}
type CurrencyDTO struct {
Id int `json:"Id"`
Title Language `json:"title"`