-
Notifications
You must be signed in to change notification settings - Fork 1
/
models.go
42 lines (36 loc) · 1.04 KB
/
models.go
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
package main
import (
"time"
)
type Response struct {
OK bool `json:"ok"`
ErrorMessage string `json:"errorMessage"`
}
// Access Control List
// ETH address string -> role
type ACL = map[string]int
const (
RoleNone = 0 // Can't do anything
RoleOwner = 1 // Can manage viewers and managers
RoleManager = 2 // Can manage viewers
RoleViewer = 3 // Can only view documents
)
// Internal data structure for FileMeta
type FileMeta struct {
Hash string `json:"hash"`
IP string `json:"ip"`
Timestamp time.Time `json:"timestamp"`
ACL ACL `json:"acl"`
Filename string `json:"filename"`
ContentType string `json:"contentType"`
ContentSize int64 `json:"contentSize"`
}
// Public version of FileMeta for end-user usage
type FileMetaPublic struct {
Hash string `json:"hash"`
Timestamp time.Time `json:"timestamp"`
ACL ACL `json:"acl"`
Filename string `json:"filename"`
ContentType string `json:"contentType"`
ContentSize int64 `json:"contentSize"`
}