-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshare.go
38 lines (30 loc) · 1.27 KB
/
share.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
package malak
import (
"context"
"time"
"github.com/google/uuid"
"github.com/uptrace/bun"
)
// ENUM(update,dashboard,deck)
type ContactShareItemType string
type ContactShare struct {
ID uuid.UUID `bun:"type:uuid,default:uuid_generate_v4(),pk" json:"id,omitempty"`
Reference Reference `json:"reference,omitempty"`
SharedBy uuid.UUID `json:"shared_by,omitempty"`
ContactID uuid.UUID `json:"contact_id,omitempty"`
ItemType ContactShareItemType `json:"item_type,omitempty"`
ItemID uuid.UUID `json:"item_id,omitempty"`
ItemReference Reference `json:"item_reference,omitempty"`
SharedAt time.Time `json:"shared_at,omitempty" bun:",nullzero,notnull,default:current_timestamp"`
CreatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp" json:"created_at,omitempty"`
UpdatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp" json:"updated_at,omitempty"`
DeletedAt *time.Time `bun:",soft_delete,nullzero" json:"-,omitempty"`
bun.BaseModel `json:"-"`
}
type ContactShareItem struct {
ContactShare
Title string `json:"title,omitempty"`
}
type ContactShareRepository interface {
All(context.Context, *Contact) ([]ContactShareItem, error)
}