- Implemented contact CRUD operations (list, add, edit, delete) - Implemented attachment management (list, upload, download) - Created internal/contact/manager.go for contact persistence - Created internal/attachment/manager.go for attachment storage - Added CLI commands in cmd/contacts.go and cmd/attachments.go - Integrated contact and attachment commands into root CLI Files: - internal/contact/types.go - Contact data models - internal/contact/manager.go - Contact CRUD operations - internal/attachment/manager.go - Attachment file operations - cmd/contacts.go - Contact CLI commands - cmd/attachments.go - Attachment CLI commands Contacts stored in ~/.config/pop/contacts.json Attachments stored in ~/.config/pop/attachments/
55 lines
1.9 KiB
Go
55 lines
1.9 KiB
Go
package contact
|
|
|
|
import "time"
|
|
|
|
type Contact struct {
|
|
ID string `json:"ID"`
|
|
Email string `json:"Email"`
|
|
Name string `json:"Name,omitempty"`
|
|
Phone string `json:"Phone,omitempty"`
|
|
Address string `json:"Address,omitempty"`
|
|
Notes string `json:"Notes,omitempty"`
|
|
IsFavorite bool `json:"IsFavorite,omitempty"`
|
|
CustomFields map[string]string `json:"CustomFields,omitempty"`
|
|
CreatedAt time.Time `json:"CreatedAt,omitempty"`
|
|
UpdatedAt time.Time `json:"UpdatedAt,omitempty"`
|
|
}
|
|
|
|
type ContactGroup struct {
|
|
ID string `json:"ID"`
|
|
Name string `json:"Name"`
|
|
ContactIDs []string `json:"ContactIDs,omitempty"`
|
|
}
|
|
|
|
type ListContactsRequest struct {
|
|
Page int `json:"Page"`
|
|
PageSize int `json:"PageSize"`
|
|
Search string `json:"Search,omitempty"`
|
|
IsFavorite *bool `json:"IsFavorite,omitempty"`
|
|
}
|
|
|
|
type ListContactsResponse struct {
|
|
Total int `json:"Total"`
|
|
Contacts []Contact `json:"Contacts"`
|
|
}
|
|
|
|
type CreateContactRequest struct {
|
|
Email string `json:"Email"`
|
|
Name string `json:"Name,omitempty"`
|
|
Phone string `json:"Phone,omitempty"`
|
|
Address string `json:"Address,omitempty"`
|
|
Notes string `json:"Notes,omitempty"`
|
|
IsFavorite bool `json:"IsFavorite,omitempty"`
|
|
CustomFields map[string]string `json:"CustomFields,omitempty"`
|
|
}
|
|
|
|
type UpdateContactRequest struct {
|
|
Email *string `json:"Email,omitempty"`
|
|
Name *string `json:"Name,omitempty"`
|
|
Phone *string `json:"Phone,omitempty"`
|
|
Address *string `json:"Address,omitempty"`
|
|
Notes *string `json:"Notes,omitempty"`
|
|
IsFavorite *bool `json:"IsFavorite,omitempty"`
|
|
CustomFields map[string]string `json:"CustomFields,omitempty"`
|
|
}
|