-
Notifications
You must be signed in to change notification settings - Fork 0
/
contact_list.go
42 lines (33 loc) · 1.21 KB
/
contact_list.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 malak
import (
"context"
"time"
"github.com/google/uuid"
"github.com/uptrace/bun"
)
var (
ErrContactListNotFound = MalakError("contact list not found")
)
type ContactList struct {
ID uuid.UUID `bun:"type:uuid,default:uuid_generate_v4(),pk" json:"id,omitempty"`
Title string `json:"title,omitempty"`
WorkspaceID uuid.UUID `json:"workspace_id,omitempty"`
Reference Reference `json:"reference,omitempty"`
CreatedBy uuid.UUID `json:"created_by,omitempty"`
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 FetchContactListOptions struct {
Reference Reference
WorkspaceID uuid.UUID
}
type ContactListRepository interface {
Create(context.Context, *ContactList) error
Get(context.Context, FetchContactListOptions) (*ContactList, error)
Delete(context.Context, *ContactList) error
Update(context.Context, *ContactList) error
// Add(context.Context, ...*Contact) error
List(context.Context, uuid.UUID) ([]ContactList, error)
}