aboutsummaryrefslogtreecommitdiff
path: root/models/node.go
blob: 7d3f7190e8dfd25f4bda04ccda53fc25b4adc8e4 (plain) (blame)
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
package models

import (
	"time"
)

type Topic struct {
	ID         uint64     `json:"id"`
	Topic      string     `json:"topic"`
	Text       string     `json:"text"`
	AuthorID   string     `json:"author_id"`
	Author     *User      `json:"-"`
	ParentID   uint64     `json:"parent_id"`
	Parent     *Topic     `json:"-"`
	Permission int        `json:"permission"`
	CreatedAt  time.Time  `json:"created_at"`
	UpdatedAt  time.Time  `json:"updated_at"`
	DeletedAt  *time.Time `json:"deleted_at"`
}

type Post struct {
	ID        uint64     `json:"id"`
	Text      string     `json:"text"`
	AuthorID  string     `json:"author_id"`
	Author    *User      `json:"-"`
	ParentID  uint64     `json:"parent_id"`
	Parent    *Post      `json:"-"`
	CreatedAt time.Time  `json:"created_at"`
	UpdatedAt time.Time  `json:"updated_at"`
	DeletedAt *time.Time `json:"deleted_at"`
	Children  []*Post    `json:"-"`
}

type Permission int

const (
	UserPost Permission = iota << 1
	UserTopic
	AdminPost
	AdminTopic
)