- Defined all 8 data models (Page, Widget, Bookmark, Note, TagAssociation, Group, Share, Preferences) - Implemented DynamoDB table creation for all tables with proper schemas - Added GSIs for efficient querying (UserBookmarksIndex, UserNotesIndex, TagItemsIndex, UserSharesIndex) - Comprehensive test coverage for all table schemas - Updated init-db command to create all tables
32 lines
1.1 KiB
Go
32 lines
1.1 KiB
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
// Share represents a shareable link for bookmarks or notes
|
|
type Share struct {
|
|
ID string `dynamodbav:"share_id" json:"id"`
|
|
UserID string `dynamodbav:"user_id" json:"user_id"`
|
|
ItemID string `dynamodbav:"item_id" json:"item_id"`
|
|
ItemType ItemType `dynamodbav:"item_type" json:"item_type"`
|
|
CreatedAt time.Time `dynamodbav:"created_at" json:"created_at"`
|
|
ExpiresAt *time.Time `dynamodbav:"expires_at,omitempty" json:"expires_at,omitempty"`
|
|
AccessCount int `dynamodbav:"access_count" json:"access_count"`
|
|
}
|
|
|
|
// ShareLink represents a shareable link with full URL
|
|
type ShareLink struct {
|
|
ShareID string `json:"share_id"`
|
|
URL string `json:"url"`
|
|
ExpiresAt *time.Time `json:"expires_at,omitempty"`
|
|
}
|
|
|
|
// SharedItem represents the data returned when accessing a shared link
|
|
type SharedItem struct {
|
|
ItemType ItemType `json:"item_type"`
|
|
Data interface{} `json:"data"`
|
|
OwnerEmail *string `json:"owner_email,omitempty"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
}
|