diff --git a/frontend/src/components/map/map_comp/map.vue b/frontend/src/components/map/map_comp/map.vue index 058c90df378158b6f2070fab358c678a771d381c..eee50394c9ae0ba88f89a08d0380614d2ad0b3c6 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 f8819b1cdba709f827a43e050edac77b54ef0891..8ae0057686ef84ade62884b86c5eab79f49705ba 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 021aa9557c1ab2813f910b83a5cc77264072cf89..a20596a4e756db70150abb5653edd331dc16790c 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 89e72de5f5c34f1a519b4a6664e650f3c45897d0..5cbc1cebd6ff960a1110f3402b2999ab760cdbd9 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 2235a1d5f640b3bb9f346344f4422b96912610a6..0b367d61459a91cac244014a006b55ff7f964763 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 ( @@ -17,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" ) @@ -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 }) } @@ -76,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 @@ -123,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 59bd1727b8db8369612332f33fd5114c3bcd9f33..9eee3c3eec56334de54f036b66f5f61f5d231f3b 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"` }