# Category

**Kind:** Database Model

**Source:** [`atloria-monorepo/libs/database/prisma/schema.prisma`](https://github.com/sherkety/atloria/blob/main/atloria-monorepo/libs/database/prisma/schema.prisma#L327)

## Fields

| Field | Type | Required | Key |
|---|---|---|---|
| `id` | `String` | ✓ | PK |
| `name` | `String` | ✓ |  |
| `slug` | `String` | ✓ |  |
| `description` | `String` | - |  |
| `icon` | `String` | - |  |
| `color` | `String` | - |  |
| `order` | `Int` | ✓ |  |
| `parentId` | `String` | - |  |
| `defaultDocId` | `String` | - | unique |
| `projectId` | `String` | ✓ |  |
| `documents` | `Document[]` | ✓ |  |
| `jobId` | `String` | - |  |
| `docVersionId` | `String` | - |  |
| `isManual` | `Boolean` | ✓ |  |
| `visibilityRule` | `Json` | - |  |
| `createdAt` | `DateTime` | ✓ |  |
| `updatedAt` | `DateTime` | ✓ |  |

## Diagram

```mermaid
erDiagram
    Category {
        id String [PK]
        name String
        slug String
        description String?
        icon String?
        color String?
        order Int
        parentId String?
        defaultDocId String? [UNIQUE]
        projectId String
        documents Document[]
        jobId String?
        docVersionId String?
        isManual Boolean
        visibilityRule Json?
        createdAt DateTime
        updatedAt DateTime
    }
    Category ||--|| Category : ""
    Category ||--}o Category : ""
    Category ||--|| Project : ""
    Category ||--|| DocVersion : ""
```

## Relationships

- HAS_ONE → `Category`
- HAS_ONE → `Category`
- HAS_ONE → `Project`
- HAS_ONE → `DocVersion`

## Referenced By

- `Category` (HAS_ONE)
- `Category` (HAS_ONE)
