generated from VLADIMIR/template
add images
This commit is contained in:
@@ -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...),
|
||||
|
||||
Reference in New Issue
Block a user