Skip to content

Add user model and SQLite storage to core service #213

@geoffjay

Description

@geoffjay

Context

The core service (#211) requires a user model for multi-user authentication support. This builds on the scaffolded core crate (#212).

Acceptance Criteria

  • Create User model struct with fields:
    • id (UUID, primary key)
    • username (TEXT, unique, not null)
    • email (TEXT, unique, not null)
    • full_name (TEXT, not null)
    • password_hash (TEXT, not null)
    • active_organization_id (UUID, nullable, foreign key to organizations)
    • created_at (TEXT/datetime)
    • updated_at (TEXT/datetime)
  • Create UserStorage with SQLite schema initialization
  • Implement CRUD operations: create, get_by_id, get_by_username, get_by_email, update, delete
  • Implement list_paginated using agentd_common::types::PaginatedResponse
  • Add password hashing using argon2 crate (hash on create, verify on login)
  • Add set_active_organization method
  • Add unit tests for all storage operations
  • Use agentd_common::storage::{get_db_path, create_pool} for DB setup

Relevant Files

  • crates/orchestrator/src/storage.rs — reference pattern for storage implementation
  • crates/common/src/storage.rs — shared storage utilities
  • New: crates/core/src/models/user.rs, crates/core/src/storage/users.rs

Dependencies

Metadata

Metadata

Assignees

No one assigned

    Labels

    complexity:largeLarge scope: 200+ lines, multiple filesenhancementNew feature or requestneeds-testsArea needs dedicated test coveragetriagedIssue has been triaged, ready for planning or implementation

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions