summaryrefslogtreecommitdiff
path: root/internal/listing
diff options
context:
space:
mode:
Diffstat (limited to 'internal/listing')
-rw-r--r--internal/listing/listing.go46
1 files changed, 46 insertions, 0 deletions
diff --git a/internal/listing/listing.go b/internal/listing/listing.go
new file mode 100644
index 0000000..1bc411e
--- /dev/null
+++ b/internal/listing/listing.go
@@ -0,0 +1,46 @@
+package listing
+
+import (
+ "time"
+
+ "codeberg.org/mihna123/openstore/internal/user"
+)
+
+type location struct {
+ city string
+ street string
+ premise string
+}
+
+type status int
+
+const (
+ draft status = iota
+ published
+ closed
+)
+
+var statusName = map[status]string{
+ draft: "draft",
+ published: "published",
+ closed: "closed",
+}
+
+func (s status) String() string {
+ return statusName[s]
+}
+
+type Listing struct {
+ id int
+ title string
+ text string
+ images []string
+ price float64
+ currency string
+ category []string
+ location location
+ status status
+ views int
+ createdAt time.Time
+ author *user.User
+}