From 73f1d5b67b62d4c3cac6d4272ad7b8e08cd44263 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=BA=D1=81=D0=B8=D0=BC=20=D0=A8=D0=B5=D0=BD?= =?UTF-8?q?=D0=B4=D1=80=D0=B8=D0=BA?= Date: Fri, 8 Aug 2025 13:08:12 +0300 Subject: [PATCH 1/2] remove: console logs --- middle/internal/application/services/apishipService.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/middle/internal/application/services/apishipService.go b/middle/internal/application/services/apishipService.go index 2235a1d..b893cad 100644 --- a/middle/internal/application/services/apishipService.go +++ b/middle/internal/application/services/apishipService.go @@ -8,7 +8,6 @@ import ( "context" "fmt" "strings" - "time" ) const ( @@ -54,15 +53,11 @@ func (s *ApishipService) GetPoints(ctx context.Context, ids []int, chunkSize int Limit: LIMIT, } - fmt.Println("1-", time.Now()) - var resp dtos.PointsResponse if err := s.client.Get(ctx, POINTS_ENDPOINT, params, &resp); err != nil { return nil, err } - fmt.Println("2-", time.Now()) - return resp.Rows, nil }) } -- GitLab From 18968ae862a572dea0941ecef262c258c53c3287 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=BA=D1=81=D0=B8=D0=BC=20=D0=A8=D0=B5=D0=BD?= =?UTF-8?q?=D0=B4=D1=80=D0=B8=D0=BA?= Date: Wed, 13 Aug 2025 13:54:23 +0300 Subject: [PATCH 2/2] feat: flags payment and enabled --- frontend/src/components/map/map_comp/map.vue | 2 + frontend/src/components/map/types.ts | 85 ++++++++++--------- .../utils/fetcher/markersService.ts | 2 + .../application/dtos/pointResponse.go | 2 + .../application/services/apishipService.go | 39 ++++++--- middle/internal/domain/models/marker.go | 26 +++--- 6 files changed, 89 insertions(+), 67 deletions(-) diff --git a/frontend/src/components/map/map_comp/map.vue b/frontend/src/components/map/map_comp/map.vue index 058c90d..eee5039 100644 --- a/frontend/src/components/map/map_comp/map.vue +++ b/frontend/src/components/map/map_comp/map.vue @@ -176,6 +176,8 @@ const selectPoint = (marker: DeliveryMarker) => { const payload = { id: String(marker.properties?.id || ''), name: String(marker.properties?.name || ''), + paymenAvailable: Boolean(marker.properties?.paymenAvailable || false), + enabled: Boolean(marker.properties?.enabled || false), address: String(marker.properties?.address || ''), email: String(marker.properties?.email || ''), timetable: String(marker.properties?.timetable || ''), diff --git a/frontend/src/components/map/types.ts b/frontend/src/components/map/types.ts index f8819b1..8ae0057 100644 --- a/frontend/src/components/map/types.ts +++ b/frontend/src/components/map/types.ts @@ -1,62 +1,65 @@ -import type { YMapMarkerProps } from '@yandex/ymaps3-types/imperative/YMapMarker' +import type { YMapMarkerProps } from "@yandex/ymaps3-types/imperative/YMapMarker"; export interface MarkerProperties extends Record { - id: string - name: string + id: string; + name: string; //photos: string[] - address: string - email: string - timetable: string - providerKey: string - tariffName: string - tariffId: number, - deliveryCost: number, - uniqueKey: string - url: string - coordinates: [number, number] + paymenAvailable: boolean; + enabled: boolean; + address: string; + email: string; + timetable: string; + providerKey: string; + tariffName: string; + tariffId: number; + deliveryCost: number; + uniqueKey: string; + url: string; + coordinates: [number, number]; } -export interface Marker extends Omit { - properties: MarkerProperties +export interface Marker extends Omit { + properties: MarkerProperties; } export interface DeliveryMarker extends Marker { - coordinates: [lon: number, lat: number, alt?: number] + coordinates: [lon: number, lat: number, alt?: number]; } -export type { YMapMarkerProps } - +export type { YMapMarkerProps }; export interface MarkersParams { to: { - addressString: string - } + addressString: string; + }; from: { - addressString: string - } + addressString: string; + }; places: Array<{ - width: number - height: number - length: number - weight: number - }> - deliveryTypes: number[] + width: number; + height: number; + length: number; + weight: number; + }>; + deliveryTypes: number[]; } export interface DeliveryPoint { - id: string - name: string + id: string; + name: string; //photos: string[] - address: string - deliveryCost: number - providerKey: string - tariffId: number - tariffName: string - email: string - lat: number - lng: number - timetable: string - url: string + paymenAvailable: boolean; + enabled: boolean; + address: string; + deliveryCost: number; + providerKey: string; + tariffId: number; + tariffName: string; + email: string; + lat: number; + lng: number; + timetable: string; + url: string; } // export interface DeliveryInfo { @@ -65,4 +68,4 @@ export interface DeliveryPoint { // providerKey: string // tariffId: number // tariffName: string -// } \ No newline at end of file +// } diff --git a/frontend/src/components/utils/fetcher/markersService.ts b/frontend/src/components/utils/fetcher/markersService.ts index 021aa95..a20596a 100644 --- a/frontend/src/components/utils/fetcher/markersService.ts +++ b/frontend/src/components/utils/fetcher/markersService.ts @@ -18,6 +18,8 @@ function transformMarkers(marker: DeliveryPoint): DeliveryMarker { id: marker.id, name: marker.name, address: marker.address, + paymenAvailable: marker.paymenAvailable, + enabled: marker.enabled, providerKey: marker.providerKey, tariffName: marker.tariffName, tariffId: marker.tariffId, diff --git a/middle/internal/application/dtos/pointResponse.go b/middle/internal/application/dtos/pointResponse.go index 89e72de..5cbc1ce 100644 --- a/middle/internal/application/dtos/pointResponse.go +++ b/middle/internal/application/dtos/pointResponse.go @@ -11,6 +11,8 @@ type PointResponse struct { Timetable string `json:"timetable"` Url string `json:"url"` Email string `json:"email"` + Cod *int `json:"cod"` Lat float64 `json:"lat"` Lng float64 `json:"lng"` + Enabled bool `json:"enabled"` } diff --git a/middle/internal/application/services/apishipService.go b/middle/internal/application/services/apishipService.go index b893cad..0b367d6 100644 --- a/middle/internal/application/services/apishipService.go +++ b/middle/internal/application/services/apishipService.go @@ -16,7 +16,7 @@ const ( ) const ( - FIELDS = "id,name,address,photos,timetable,url,email,lat,lng" + FIELDS = "id,name,address,timetable,url,cod,email,lat,lng,enabled" LIMIT = "10000" ) @@ -71,7 +71,11 @@ func (s *ApishipService) GetPoints(ctx context.Context, ids []int, chunkSize int var points []dtos.PointResponse for _, rows := range chunkResults { - points = append(points, rows...) + for _, point := range rows { + if point.Enabled { + points = append(points, point) + } + } } return points, nil @@ -118,20 +122,27 @@ func (s *ApishipService) GetMarkers(ctx context.Context, payload dtos.CalculateR var markers []models.Marker for _, point := range points { tariffInfo := pointTariffMap[point.Id] + paymenAvailable := true + + if point.Cod == nil || *point.Cod == 0 { + paymenAvailable = false + } markers = append(markers, models.Marker{ - Id: point.Id, - Name: point.Name, - Address: point.Address, - Lat: point.Lat, - Lng: point.Lng, - Timetable: point.Timetable, - Url: point.Url, - Email: point.Email, - TariffId: tariffInfo.Id, - TariffName: tariffInfo.Name, - ProviderKey: tariffInfo.ProviderKey, - DeliveryCost: tariffInfo.DeliveryCost, + Id: point.Id, + Name: point.Name, + Address: point.Address, + Lat: point.Lat, + Lng: point.Lng, + Timetable: point.Timetable, + Url: point.Url, + Email: point.Email, + PaymenAvailable: paymenAvailable, + Enabled: point.Enabled, + TariffId: tariffInfo.Id, + TariffName: tariffInfo.Name, + ProviderKey: tariffInfo.ProviderKey, + DeliveryCost: tariffInfo.DeliveryCost, }) } diff --git a/middle/internal/domain/models/marker.go b/middle/internal/domain/models/marker.go index 59bd172..9eee3c3 100644 --- a/middle/internal/domain/models/marker.go +++ b/middle/internal/domain/models/marker.go @@ -8,16 +8,18 @@ type TariffInfo struct { } type Marker struct { - Id int `json:"id"` - Name string `json:"name"` - Address string `json:"address"` - Lat float64 `json:"lat"` - Lng float64 `json:"lng"` - Timetable string `json:"timetable"` - Url string `json:"url"` - Email string `json:"email"` - TariffId int `json:"tariffId"` - TariffName string `json:"tariffNname"` - ProviderKey string `json:"providerKey"` - DeliveryCost float64 `json:"deliveryCost"` + Id int `json:"id"` + Name string `json:"name"` + Address string `json:"address"` + Lat float64 `json:"lat"` + Lng float64 `json:"lng"` + Timetable string `json:"timetable"` + Url string `json:"url"` + Email string `json:"email"` + PaymenAvailable bool `json:"paymenAvailable"` + Enabled bool `json:"enabled"` + TariffId int `json:"tariffId"` + TariffName string `json:"tariffNname"` + ProviderKey string `json:"providerKey"` + DeliveryCost float64 `json:"deliveryCost"` } -- GitLab