- 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
41 lines
1.4 KiB
Go
41 lines
1.4 KiB
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
// WidgetType represents the type of widget
|
|
type WidgetType string
|
|
|
|
const (
|
|
WidgetTypeBookmark WidgetType = "bookmark"
|
|
WidgetTypeNotes WidgetType = "notes"
|
|
WidgetTypeWeather WidgetType = "weather"
|
|
)
|
|
|
|
// Position represents the x,y coordinates of a widget
|
|
type Position struct {
|
|
X int `dynamodbav:"x" json:"x"`
|
|
Y int `dynamodbav:"y" json:"y"`
|
|
}
|
|
|
|
// Size represents the width and height of a widget
|
|
type Size struct {
|
|
Width int `dynamodbav:"width" json:"width"`
|
|
Height int `dynamodbav:"height" json:"height"`
|
|
}
|
|
|
|
// Widget represents a modular component that displays specific content
|
|
type Widget struct {
|
|
ID string `dynamodbav:"widget_id" json:"id"`
|
|
PageID string `dynamodbav:"page_id" json:"page_id"`
|
|
UserID string `dynamodbav:"user_id" json:"user_id"`
|
|
Type WidgetType `dynamodbav:"type" json:"type"`
|
|
Title *string `dynamodbav:"title,omitempty" json:"title,omitempty"`
|
|
Position Position `dynamodbav:"position" json:"position"`
|
|
Size Size `dynamodbav:"size" json:"size"`
|
|
Config map[string]interface{} `dynamodbav:"config" json:"config"`
|
|
CreatedAt time.Time `dynamodbav:"created_at" json:"created_at"`
|
|
UpdatedAt time.Time `dynamodbav:"updated_at" json:"updated_at"`
|
|
}
|