From a24690f2bee8314cc4c08c26b1709478893e7938 Mon Sep 17 00:00:00 2001 From: mihna123 Date: Sun, 23 Aug 2026 17:45:41 +0200 Subject: listing: add slug prop to struct and export some more props and constants --- internal/listing/listing.go | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/internal/listing/listing.go b/internal/listing/listing.go index de769cc..773da66 100644 --- a/internal/listing/listing.go +++ b/internal/listing/listing.go @@ -7,43 +7,44 @@ import ( "codeberg.org/mihna123/openstore/internal/user" ) -type location struct { +type Location struct { city string street string premise string } -type status int +type Status int const ( - draft status = iota - published - closed + DraftStatus Status = iota + PublishedStatus + ClosedStatus ) -var statusName = map[status]string{ - draft: "draft", - published: "published", - closed: "closed", +var statusName = map[Status]string{ + DraftStatus: "draft", + PublishedStatus: "published", + ClosedStatus: "closed", } -func (s status) String() string { +func (s Status) String() string { return statusName[s] } type Listing struct { id int title string + slug string description string images []string price float64 currency string category []string - location location - status status + location Location + status Status views int createdAt time.Time author *user.User isExternal bool - origin url.URL + origin *url.URL } -- cgit v1.3.1