- 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
30 lines
819 B
Go
30 lines
819 B
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
// ItemType represents the type of item that can be tagged
|
|
type ItemType string
|
|
|
|
const (
|
|
ItemTypeBookmark ItemType = "bookmark"
|
|
ItemTypeNote ItemType = "note"
|
|
)
|
|
|
|
// TagAssociation represents a many-to-many relationship between tags and items
|
|
type TagAssociation struct {
|
|
ItemID string `dynamodbav:"item_id" json:"item_id"`
|
|
TagName string `dynamodbav:"tag_name" json:"tag_name"`
|
|
UserID string `dynamodbav:"user_id" json:"user_id"`
|
|
ItemType ItemType `dynamodbav:"item_type" json:"item_type"`
|
|
CreatedAt time.Time `dynamodbav:"created_at" json:"created_at"`
|
|
}
|
|
|
|
// TagInfo represents tag metadata with usage statistics
|
|
type TagInfo struct {
|
|
Name string `json:"name"`
|
|
Count int `json:"count"`
|
|
ItemTypes []ItemType `json:"item_types"`
|
|
}
|