delibwrite / app

0 stars 0 forks source link

Project Requirements #1

Open thuey opened 3 hours ago

thuey commented 3 hours ago

Creative Writing Practice Application - Requirements Document

1. System Overview

A web-based application that helps users practice specific elements of creative writing through guided prompts and tracking capabilities.

2. Functional Requirements

2.1 Writing Element Selection

2.2 Prompt Generation

2.3 Writing Interface

2.4 Writing History

2.5 Analytics Dashboard

2.6 Goal Setting

3. Non-Functional Requirements

3.1 Performance

3.2 Security

3.3 Usability

4. Technical Requirements

4.1 Frontend

4.2 Backend

4.3 Infrastructure

5. Future Enhancements

thuey commented 3 hours ago
-- Modified schema.sql with UUIDs
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";

CREATE TABLE users (
    user_id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
    email VARCHAR(255) UNIQUE NOT NULL,
    password_hash VARCHAR(255) NOT NULL,
    created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
    last_login TIMESTAMP WITH TIME ZONE
);

CREATE TABLE writing_elements (
    element_id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
    name VARCHAR(50) NOT NULL,
    description TEXT,
    created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE prompts (
    prompt_id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
    element_id UUID REFERENCES writing_elements(element_id),
    content TEXT NOT NULL,
    suggested_word_count INTEGER,
    estimated_time_minutes INTEGER,
    created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE writings (
    writing_id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
    user_id UUID REFERENCES users(user_id),
    prompt_id UUID REFERENCES prompts(prompt_id),
    element_id UUID REFERENCES writing_elements(element_id),
    content TEXT NOT NULL,
    word_count INTEGER NOT NULL,
    time_spent_seconds INTEGER NOT NULL,
    created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE writing_stats (
    stat_id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
    user_id UUID REFERENCES users(user_id),
    date DATE NOT NULL,
    total_words INTEGER DEFAULT 0,
    total_time_seconds INTEGER DEFAULT 0,
    elements_practiced UUID[] DEFAULT '{}',
    UNIQUE(user_id, date)
);

CREATE TABLE goals (
    goal_id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
    user_id UUID REFERENCES users(user_id),
    goal_type VARCHAR(50) NOT NULL,
    target_value INTEGER NOT NULL,
    start_date DATE NOT NULL,
    end_date DATE,
    completed BOOLEAN DEFAULT FALSE,
    created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE goal_progress (
    progress_id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
    goal_id UUID REFERENCES goals(goal_id),
    date DATE NOT NULL,
    current_value INTEGER NOT NULL,
    created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
    UNIQUE(goal_id, date)
);