forked from mengyxu/noob-components
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1.2 KiB
1.2 KiB
Log API
plugs/api/log.ts- Log operations.
Overview
Action logging API with only list/query functionality. Logs are typically read-only.
Endpoint
- Root:
log/action
Exports
| Function | HTTP | Description |
|---|---|---|
list |
GET | List action logs with filter |
Functions
list
export const list = (example) => {
return queryPage(root, example);
};
- Uses:
queryPagefrom base - URL:
log/action - Parameters:
example- Filter criteria (optional) - Returns: Paginated result
Usage Example
import { log } from 'plugs/api';
// List all logs
const logs = await log.list();
// Filter by user
const userLogs = await log.list({ userId: 123 });
// Filter by date range
const recentLogs = await log.list({
startDate: '2024-01-01',
endDate: '2024-01-31'
});
Pattern Notes
- Read-only API - No create, update, or delete operations
- Uses
queryPage- Returns paginated results (appropriate for log queries) - URL uses
/actionsubpath:log/actionnot justlog
Similar Patterns
Other read-only APIs following this pattern:
dictionary.tsusesqueryPagebut has CRUDlog.tsis strictly read-only