From dadc6de754c699ebd3c08f797f2e7db2afb28e6c Mon Sep 17 00:00:00 2001 From: mihna123 Date: Sat, 22 Aug 2026 17:12:56 +0200 Subject: listing: implement a basic listing struct along with user struct stub --- internal/listing/listing.go | 46 +++++++++++++++++++++++++++++++++++++++++++++ internal/user/user.go | 9 +++++++++ 2 files changed, 55 insertions(+) create mode 100644 internal/listing/listing.go create mode 100644 internal/user/user.go 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 +} diff --git a/internal/user/user.go b/internal/user/user.go new file mode 100644 index 0000000..04f3dae --- /dev/null +++ b/internal/user/user.go @@ -0,0 +1,9 @@ +package user + +type User struct { + id int + email string + username string + phone string + passwordHash string +} -- cgit v1.3.1