diff options
| author | mihna123 <mihailonvojinovic@gmail.com> | 2026-08-22 17:12:56 +0200 |
|---|---|---|
| committer | mihna123 <mihailonvojinovic@gmail.com> | 2026-08-22 17:12:56 +0200 |
| commit | dadc6de754c699ebd3c08f797f2e7db2afb28e6c (patch) | |
| tree | e590371ed0aab78621e2fb79fc6b3945b12384d9 | |
| parent | ba8b50f25ec898d77f736c4435770c80143ae5a1 (diff) | |
| download | openstore-dadc6de754c699ebd3c08f797f2e7db2afb28e6c.tar.gz openstore-dadc6de754c699ebd3c08f797f2e7db2afb28e6c.zip | |
listing: implement a basic listing struct along with user struct stub
| -rw-r--r-- | internal/listing/listing.go | 46 | ||||
| -rw-r--r-- | internal/user/user.go | 9 |
2 files changed, 55 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 +} 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 +} |
