# Codev

## Read records

> Retrieves records from the specified Codev table with optional filtering and field selection. Features:\
> &#x20;   \- Select specific fields using comma-separated field names\
> &#x20;   \- Filter results using JSON-formatted query conditions\
> &#x20;   \- Returns all matching records as an array\
> &#x20;   \
> &#x20;   Common use cases:\
> &#x20;   \- Get all commits for a specific repository\
> &#x20;   \- Find deployments within a date range\
> &#x20;   \- List issues assigned to a user\
> &#x20;   \- Track file changes across branches\
> &#x20;   \
> &#x20;   Returns empty array if no records match the criteria.

```json
{"openapi":"3.0.0","info":{"title":"sfp server","version":"51.3.0"},"security":[{"access-token":[]}],"components":{"securitySchemes":{"access-token":{"scheme":"bearer","bearerFormat":"JWT","type":"http","in":"header"}}},"paths":{"/sfp/api/codev/{table}":{"get":{"operationId":"CodevCrudController_read","summary":"Read records","description":"Retrieves records from the specified Codev table with optional filtering and field selection. Features:\n    - Select specific fields using comma-separated field names\n    - Filter results using JSON-formatted query conditions\n    - Returns all matching records as an array\n    \n    Common use cases:\n    - Get all commits for a specific repository\n    - Find deployments within a date range\n    - List issues assigned to a user\n    - Track file changes across branches\n    \n    Returns empty array if no records match the criteria.","parameters":[{"name":"table","required":true,"in":"path","description":"The table to read from","schema":{"type":"string"}},{"name":"select","required":false,"in":"query","description":"Comma-separated list of fields to return (defaults to *)","schema":{"type":"string"}},{"name":"filter","required":false,"in":"query","description":"JSON string of filter conditions","schema":{"type":"string"}}],"responses":{"200":{"description":"Records retrieved successfully.","content":{"application/json":{}}},"403":{"description":"Forbidden - Requires role: member, application"}},"tags":["Codev"]}}}}
```

## Create a new record

> Creates a new record in the specified Codev table. Codev tables store various development lifecycle data including:\
> &#x20;   \- codev\_commit\_stream: Git commit history and metadata\
> &#x20;   \- codev\_deploy\_stream: Deployment events and status\
> &#x20;   \- codev\_file\_stream: File change tracking\
> &#x20;   \- codev\_user: Developer profiles and activity\
> &#x20;   \- codev\_issue: Issue tracking and management\
> &#x20;   \- codev\_review\_stream: Code review activity\
> &#x20;   \- codev\_tasks: Task management and tracking\
> &#x20;   \
> &#x20;   The data structure varies by table type. See examples for each table's schema. Returns the created record with generated ID and timestamps.

```json
{"openapi":"3.0.0","info":{"title":"sfp server","version":"51.3.0"},"security":[{"access-token":[]}],"components":{"securitySchemes":{"access-token":{"scheme":"bearer","bearerFormat":"JWT","type":"http","in":"header"}},"schemas":{"CodevCreateDto":{"type":"object","properties":{"table":{"type":"string","description":"The table to create the record in"},"data":{"type":"object","description":"The data to create"},"fetchAll":{"type":"boolean","description":"When true, returns all created records. When false or omitted, returns only the first record","default":false}},"required":["table","data"]}}},"paths":{"/sfp/api/codev/{table}":{"post":{"operationId":"CodevCrudController_create","summary":"Create a new record","description":"Creates a new record in the specified Codev table. Codev tables store various development lifecycle data including:\n    - codev_commit_stream: Git commit history and metadata\n    - codev_deploy_stream: Deployment events and status\n    - codev_file_stream: File change tracking\n    - codev_user: Developer profiles and activity\n    - codev_issue: Issue tracking and management\n    - codev_review_stream: Code review activity\n    - codev_tasks: Task management and tracking\n    \n    The data structure varies by table type. See examples for each table's schema. Returns the created record with generated ID and timestamps.","parameters":[{"name":"table","required":true,"in":"path","description":"The table to create the record in","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CodevCreateDto"}}}},"responses":{"201":{"description":"Record created successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CodevCreateDto"}}}},"403":{"description":"Forbidden - Requires role: member, application"},"409":{"description":"Conflict error."}},"tags":["Codev"]}}}}
```

## Update records

> Updates existing records in the specified Codev table that match the filter conditions. This endpoint:\
> &#x20;   \- Updates all records matching the filter criteria\
> &#x20;   \- Supports partial updates (only specified fields are modified)\
> &#x20;   \- Automatically updates the updated\_at timestamp\
> &#x20;   \- Returns all updated records with their new values\
> &#x20;   \
> &#x20;   Common use cases:\
> &#x20;   \- Update deployment status\
> &#x20;   \- Mark issues as resolved\
> &#x20;   \- Update task assignments\
> &#x20;   \- Modify review states\
> &#x20;   \
> &#x20;   The filter parameter is required to prevent accidental bulk updates. Use specific filters to target intended records.

```json
{"openapi":"3.0.0","info":{"title":"sfp server","version":"51.3.0"},"security":[{"access-token":[]}],"components":{"securitySchemes":{"access-token":{"scheme":"bearer","bearerFormat":"JWT","type":"http","in":"header"}},"schemas":{"CodevUpdateDataDto":{"type":"object","properties":{"data":{"type":"object","description":"The data to update matched records with"}},"required":["data"]}}},"paths":{"/sfp/api/codev/{table}":{"put":{"operationId":"CodevCrudController_update","summary":"Update records","description":"Updates existing records in the specified Codev table that match the filter conditions. This endpoint:\n    - Updates all records matching the filter criteria\n    - Supports partial updates (only specified fields are modified)\n    - Automatically updates the updated_at timestamp\n    - Returns all updated records with their new values\n    \n    Common use cases:\n    - Update deployment status\n    - Mark issues as resolved\n    - Update task assignments\n    - Modify review states\n    \n    The filter parameter is required to prevent accidental bulk updates. Use specific filters to target intended records.","parameters":[{"name":"table","required":true,"in":"path","description":"The table to update records in","schema":{"type":"string"}},{"name":"filter","required":true,"in":"query","description":"JSON string of query conditions to match records to update","schema":{"type":"string"}}],"requestBody":{"required":true,"description":"The data to update matched records with","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CodevUpdateDataDto"}}}},"responses":{"200":{"description":"Records updated successfully.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CodevUpdateDataDto"}}}}},"403":{"description":"Forbidden - Requires role: member, application"}},"tags":["Codev"]}}}}
```

## Delete records

> Permanently deletes records from the specified Codev table that match the query conditions. This operation:\
> &#x20;   \- Removes all records matching the query criteria\
> &#x20;   \- Cannot be undone - deleted data is permanently lost\
> &#x20;   \- Returns no content on successful deletion\
> &#x20;   \
> &#x20;   Safety considerations:\
> &#x20;   \- Always use specific query conditions to avoid mass deletion\
> &#x20;   \- Consider archiving data instead of deletion for audit trails\
> &#x20;   \- Some tables may have referential integrity constraints\
> &#x20;   \
> &#x20;   Common use cases:\
> &#x20;   \- Remove outdated deployment records\
> &#x20;   \- Clean up resolved issues\
> &#x20;   \- Delete test data

```json
{"openapi":"3.0.0","info":{"title":"sfp server","version":"51.3.0"},"security":[{"access-token":[]}],"components":{"securitySchemes":{"access-token":{"scheme":"bearer","bearerFormat":"JWT","type":"http","in":"header"}},"schemas":{"CodevDeleteDto":{"type":"object","properties":{"key":{"type":"string","description":"The field name to filter by"},"value":{"type":"object","description":"The value to match for deletion"}},"required":["key","value"]}}},"paths":{"/sfp/api/codev/{table}":{"delete":{"operationId":"CodevCrudController_delete","summary":"Delete records","description":"Permanently deletes records from the specified Codev table that match the query conditions. This operation:\n    - Removes all records matching the query criteria\n    - Cannot be undone - deleted data is permanently lost\n    - Returns no content on successful deletion\n    \n    Safety considerations:\n    - Always use specific query conditions to avoid mass deletion\n    - Consider archiving data instead of deletion for audit trails\n    - Some tables may have referential integrity constraints\n    \n    Common use cases:\n    - Remove outdated deployment records\n    - Clean up resolved issues\n    - Delete test data","parameters":[{"name":"table","required":true,"in":"path","description":"The table to delete records from","schema":{"type":"string"}}],"requestBody":{"required":true,"description":"The key and value to identify which records to delete.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CodevDeleteDto"}}}},"responses":{"200":{"description":"Records deleted successfully."},"403":{"description":"Forbidden - Requires role: member, application"}},"tags":["Codev"]}}}}
```

## Insert or update records

> Performs an upsert operation (insert or update) on the specified Codev table. This endpoint:\
> &#x20;   \- Attempts to insert the provided data as a new record\
> &#x20;   \- If a conflict occurs on specified columns, updates the existing record instead\
> &#x20;   \- Useful for idempotent operations and syncing external data\
> &#x20;   \
> &#x20;   The onConflict parameter specifies which columns to check for uniqueness:\
> &#x20;   \- For commits: typically \['commit'] (commit hash)\
> &#x20;   \- For deployments: \['deployment\_id'] or \['repo', 'environment', 'timestamp']\
> &#x20;   \- For users: \['email'] or \['username']\
> &#x20;   \
> &#x20;   Returns the inserted or updated record(s). This is the preferred method for syncing data from external systems where you're unsure if the record already exists.

```json
{"openapi":"3.0.0","info":{"title":"sfp server","version":"51.3.0"},"security":[{"access-token":[]}],"components":{"securitySchemes":{"access-token":{"scheme":"bearer","bearerFormat":"JWT","type":"http","in":"header"}},"schemas":{"CodevUpsertDto":{"type":"object","properties":{"data":{"type":"object","description":"The data to insert. If a record with matching onConflict columns exists, this data will update that record instead."},"onConflict":{"description":"The columns to check for conflicts. If a record exists with the same values for these columns, it will be updated instead of inserted.","type":"array","items":{"type":"string"}}},"required":["data"]}}},"paths":{"/sfp/api/codev/{table}/upsert":{"put":{"operationId":"CodevCrudController_upsert","summary":"Insert or update records","description":"Performs an upsert operation (insert or update) on the specified Codev table. This endpoint:\n    - Attempts to insert the provided data as a new record\n    - If a conflict occurs on specified columns, updates the existing record instead\n    - Useful for idempotent operations and syncing external data\n    \n    The onConflict parameter specifies which columns to check for uniqueness:\n    - For commits: typically ['commit'] (commit hash)\n    - For deployments: ['deployment_id'] or ['repo', 'environment', 'timestamp']\n    - For users: ['email'] or ['username']\n    \n    Returns the inserted or updated record(s). This is the preferred method for syncing data from external systems where you're unsure if the record already exists.","parameters":[{"name":"table","required":true,"in":"path","description":"The table to insert/update records in","schema":{"type":"string"}}],"requestBody":{"required":true,"description":"The data to insert/update and optional conflict columns. If onConflict is specified and a record matches those columns, it will be updated instead of inserted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CodevUpsertDto"}}}},"responses":{"200":{"description":"Record inserted or updated successfully."},"403":{"description":"Forbidden - Requires role: member, application"}},"tags":["Codev"]}}}}
```
