Initial commit: Custom Start Page application with authentication and DynamoDB storage
This commit is contained in:
45
cmd/server/init_tables.go
Normal file
45
cmd/server/init_tables.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"custom-start-page/internal/storage"
|
||||
)
|
||||
|
||||
// InitializeTables creates all required DynamoDB tables
|
||||
func InitializeTables() error {
|
||||
ctx := context.Background()
|
||||
|
||||
// Get DynamoDB endpoint from environment (for local development)
|
||||
endpoint := os.Getenv("DYNAMODB_ENDPOINT")
|
||||
if endpoint == "" {
|
||||
endpoint = "http://localhost:8000" // Default for DynamoDB local
|
||||
}
|
||||
|
||||
// Create DynamoDB client
|
||||
db, err := storage.NewDynamoDBClient(ctx, endpoint)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create DynamoDB client: %w", err)
|
||||
}
|
||||
|
||||
log.Println("Creating Users table...")
|
||||
if err := db.CreateUsersTable(ctx); err != nil {
|
||||
return fmt.Errorf("failed to create Users table: %w", err)
|
||||
}
|
||||
log.Println("Users table created successfully")
|
||||
|
||||
// TODO: Add other table creation calls here as they are implemented
|
||||
// - Pages table
|
||||
// - Widgets table
|
||||
// - Bookmarks table
|
||||
// - Notes table
|
||||
// - TagAssociations table
|
||||
// - Groups table
|
||||
// - SharedItems table
|
||||
// - Preferences table
|
||||
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user