summaryrefslogtreecommitdiff
path: root/internal/listing/listing.go
blob: de769cc154d61c46d672e64be290eb8c759ec0db (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
47
48
49
package listing

import (
	"net/url"
	"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
	description string
	images      []string
	price       float64
	currency    string
	category    []string
	location    location
	status      status
	views       int
	createdAt   time.Time
	author      *user.User
	isExternal  bool
	origin      url.URL
}