Complete tasks 3.2-3.3: Data models and DynamoDB table schemas
- 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
This commit is contained in:
29
internal/models/tag.go
Normal file
29
internal/models/tag.go
Normal file
@@ -0,0 +1,29 @@
|
||||
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"`
|
||||
}
|
||||
Reference in New Issue
Block a user