# GetMyEbooksQuery

- File ID: file:16axv5i:getmyebooksquery-cs
- Path: NexusReader.Application/Queries/Library/GetMyEbooksQuery.cs
- Role: handler
- Layer: application

## Purpose

MediatR query and handler that reads the current user's ebooks from the AppDbContext, projects them into LastReadBookDto instances, and returns them wrapped in a FluentResults Result.

## Key Details

Performs a single DB query projecting entities to LastReadBookDto; uses IDbContextFactory for DbContext creation and returns a FluentResults Result wrapping the list.

## Symbols

- GetMyEbooksQueryHandler: MediatR query and handler that reads the current user's ebooks from the AppDbContext, projects them into LastReadBookDto instances, and returns them wrapped in a FluentResults Result.
- Handle(): Opens a DbContext, queries ebooks for the given user id, projects results to LastReadBookDto list, and returns Result.Ok(list).
- GetMyEbooksQueryHandler (ctor): Stores injected IDbContextFactory<AppDbContext> to a readonly field.
- GetMyEbooksQuery: MediatR request holding the UserId for which ebooks should be fetched.

## Dependencies

- No resolved dependencies.

## Calls

- No resolved calls.

## Unresolved References

- dependency-target: NexusReader.Application.DTOs.User
- dependency-target: NexusReader.Data.Persistence
- dependency-target: FluentResults
- dependency-target: MediatR
- dependency-target: Microsoft.EntityFrameworkCore
- interaction-target: .Where(e => e.UserId == request.UserId)
- interaction-target: ToListAsync(cancellationToken) - EF Core async materialization

## Coverage

- Symbols: 4
- Executable symbols: 2
- Executable symbols with control flow: 2
- Grounded edges: 4
- Unresolved references: 7
- Control-flow fragments: 2
- Unresolved jumps: 0
- Unsupported constructs: 0
- Control-flow coverage: 100%
- Required diagrams: 2
- Generated diagrams: 2

## Control Flow Fragments

- Handle: 12 nodes, 11 edges, 0 jumps, 0 unsupported constructs
- GetMyEbooksQueryHandler (ctor): 3 nodes, 2 edges, 0 jumps, 0 unsupported constructs

## Diagrams

### GetMyEbooksQuery Neighborhood

```mermaid
flowchart LR
    class_1far2m1_getmyebooksqueryhandler("GetMyEbooksQueryHandler")
    file_16axv5i_getmyebooksquery_cs("GetMyEbooksQuery")
    method_1epuq0y_handle[["Handle()"]]
    method_527vme_getmyebooksqueryhandler_ctor[["GetMyEbooksQueryHandler (ctor)"]]
    type_y84j0y_getmyebooksquery[/"GetMyEbooksQuery"/]
```

### GetMyEbooksQuery Execution Overview

```mermaid
flowchart TD
    class_1far2m1_getmyebooksqueryhandler("GetMyEbooksQueryHandler")
    method_1epuq0y_handle[["Handle()"]]
    method_527vme_getmyebooksqueryhandler_ctor[["GetMyEbooksQueryHandler (ctor)"]]
    unresolved_unresolved_wfw9je_interaction_target{"Unresolved: ToListAsync(cancellationToken) - EF Core async materialization"}
    unresolved_unresolved_x17hvs_interaction_target{"Unresolved: .Where(e => e.UserId == request.UserId)"}
    class_1far2m1_getmyebooksqueryhandler -->|contains| method_1epuq0y_handle
    class_1far2m1_getmyebooksqueryhandler -->|contains| method_527vme_getmyebooksqueryhandler_ctor
    class_1far2m1_getmyebooksqueryhandler -->|unresolved interaction| unresolved_unresolved_wfw9je_interaction_target
    class_1far2m1_getmyebooksqueryhandler -->|unresolved interaction| unresolved_unresolved_x17hvs_interaction_target
```

## Diagram Validation

- Status: pass
