diff options
Diffstat (limited to 'internal')
| -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 +} |
