summaryrefslogtreecommitdiff
path: root/internal/listing/listing.go
blob: 773da667dd76f10c121805240ec60785cdd40668 (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
50
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 (
	DraftStatus Status = iota
	PublishedStatus
	ClosedStatus
)

var statusName = map[Status]string{
	DraftStatus:     "draft",
	PublishedStatus: "published",
	ClosedStatus:    "closed",
}

func (s Status) String() string {
	return statusName[s]
}

type Listing struct {
	id          int
	title       string
	slug        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
}