summaryrefslogtreecommitdiff
path: root/internal/listing/listing.go
blob: 1bc411ef6a672919e844e5ccd82202c458591d53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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
}