add images

This commit is contained in:
2026-03-14 16:02:33 +07:00
parent 4ae2715ab0
commit ae82f8e0d9
6 changed files with 58 additions and 11 deletions
@@ -4,6 +4,7 @@ type Place struct {
Code string `json:"code"`
Name string `json:"name"`
Text string `json:"text"`
Image string `json:"image"`
Applications []*Application `json:"applications,omitempty"`
Hidden bool `json:"hidden"`
Doors []*Door `json:"doors"`
@@ -36,6 +37,13 @@ func NewClientErrorPlace(code string) *Place {
type PlaceOpt func(place *Place) error
func WithPlaceImage(image string) PlaceOpt {
return func(place *Place) error {
place.Image = image
return nil
}
}
func WithPlaceApplication(applications ...*Application) PlaceOpt {
return func(place *Place) error {
for _, application := range applications {
@@ -77,6 +77,7 @@ func (s *StoryService) GetPlace(code string) *models.Place {
place.Code,
place.Name,
s.cleaner.ClearText(place.Text),
models.WithPlaceImage(place.Image),
models.WithPlaceApplication(applications...),
models.WithPlaceHidden(place.Hidden),
models.WithPlaceDoors(doors...),