feat: Add MicroDAO Dashboard with activity feed and statistics
- Add microdao_activity table for news/updates/events - Add statistics columns to microdaos table - Implement dashboard API endpoints - Create UI components (HeaderCard, ActivitySection, TeamSection) - Add seed data for DAARION DAO - Update backend models and repositories - Add frontend types and API client
This commit is contained in:
22
migrations/044_microdao_activity.sql
Normal file
22
migrations/044_microdao_activity.sql
Normal file
@@ -0,0 +1,22 @@
|
||||
-- 044_microdao_activity.sql
|
||||
-- Migration: Create microdao_activity table for news/updates/events feed
|
||||
|
||||
CREATE TABLE IF NOT EXISTS microdao_activity (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
microdao_slug TEXT NOT NULL REFERENCES microdaos(slug) ON DELETE CASCADE,
|
||||
kind TEXT NOT NULL CHECK (kind IN ('post', 'event', 'update')),
|
||||
title TEXT,
|
||||
body TEXT NOT NULL,
|
||||
author_agent_id TEXT NULL,
|
||||
author_name TEXT NULL,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_microdao_activity_microdao_created_at
|
||||
ON microdao_activity (microdao_slug, created_at DESC);
|
||||
|
||||
COMMENT ON TABLE microdao_activity IS 'Activity feed for MicroDAO: posts, events, updates';
|
||||
COMMENT ON COLUMN microdao_activity.kind IS 'Type: post (news), event (announcement), update (status change)';
|
||||
COMMENT ON COLUMN microdao_activity.author_agent_id IS 'Optional reference to agent who created this activity';
|
||||
COMMENT ON COLUMN microdao_activity.author_name IS 'Fallback author name if agent_id is not set';
|
||||
|
||||
14
migrations/045_microdao_stats.sql
Normal file
14
migrations/045_microdao_stats.sql
Normal file
@@ -0,0 +1,14 @@
|
||||
-- 045_microdao_stats.sql
|
||||
-- Migration: Add statistics columns to microdaos table
|
||||
|
||||
ALTER TABLE microdaos
|
||||
ADD COLUMN IF NOT EXISTS citizens_count INTEGER NOT NULL DEFAULT 0,
|
||||
ADD COLUMN IF NOT EXISTS rooms_count INTEGER NOT NULL DEFAULT 0,
|
||||
ADD COLUMN IF NOT EXISTS agents_count INTEGER NOT NULL DEFAULT 0,
|
||||
ADD COLUMN IF NOT EXISTS last_update_at TIMESTAMPTZ;
|
||||
|
||||
COMMENT ON COLUMN microdaos.citizens_count IS 'Cached count of citizens (public agents) linked to this MicroDAO';
|
||||
COMMENT ON COLUMN microdaos.rooms_count IS 'Cached count of rooms belonging to this MicroDAO';
|
||||
COMMENT ON COLUMN microdaos.agents_count IS 'Cached count of agents (all) linked to this MicroDAO';
|
||||
COMMENT ON COLUMN microdaos.last_update_at IS 'Last time statistics were updated';
|
||||
|
||||
Reference in New Issue
Block a user