File Types Service
Overview
File Types define categories for file attachments, allowing consistent classification and organization.
They provide:
- categorization for files
- icon support for UI display
- filtering and organizing capabilities
File types are referenced by files but are managed independently.
All file type operations are tenant-aware and scoped to the current tenant.
Endpoints
GET
/api/v1/FileTypes/{id}
Returns a single file type by its numeric identifier.
Path parameters:
id(long, required) - file type identifier
Behavior:
- Looks up file type by ID
- Returns
404if the file type does not exist
Authorization:
- Anonymous access allowed (requires valid domain in request headers)
GET
/api/v1/FileTypes
Returns all file types.
Behavior:
- Returns all file types for the tenant
- Returns
404if no file types exist
Authorization:
- Anonymous access allowed (requires valid domain in request headers)
POST
/api/v1/FileTypes
Creates a new file type.
Request body:
Title(string, required) - file type display nameIcon(string, optional) - icon identifier
Behavior:
- Validation is handled in the service layer
CreatedAtis set automatically- Successful creation writes an audit log entry
Errors:
- Returns
400if validation fails
Authorization:
- Requires Bearer Token
PUT
/api/v1/FileTypes/{id}
Updates an existing file type.
Request:
- File type ID is taken from the route
- Body must include:
Title(string, required)
- Optional:
Icon(string)
Behavior:
- Successful update writes an audit log entry
Errors:
- Returns
400if validation fails or file type does not exist
Authorization:
- Requires Bearer Token
DELETE
/api/v1/FileTypes/{id}
Deletes a file type by its identifier.
Behavior:
- Performs a hard delete
- Record is permanently removed from the database
- Successful deletion writes an audit log entry
Errors:
- Returns
400if file type does not exist
Authorization:
- Requires Bearer Token
Notes
- File types provide categorization for files
- Deleting a file type does not affect existing files referencing it
- Validation is enforced in the service layer
- All state-changing operations are audited
- Internal errors are logged but not exposed to clients