buster/web/.cursor/rules/api_buster_request_interfac...

71 lines
1.7 KiB
Plaintext
Raw Normal View History

2025-02-14 04:09:38 +08:00
---
description: This will be used whenever we need a type for a request either from rest or web socket
globs: src/api/request_interfaces/**/*
---
# Cursor Rules
## Directory Structure
This directory contains all the namespaces, each organized into separate folders. Every namespace follows this structure:
```
/namespaces/
├── namespace1/
│ ├── index.ts
│ ├── interfaces.ts
├── namespace2/
│ ├── index.ts
│ ├── interfaces.ts
...
```
### File Descriptions
#### `index.ts`
- This file serves as the entry point for the namespace, exporting all relevant types and utilities.
#### `interfaces.ts`
- This file defines the TypeScript interfaces for the namespace.
- All interfaces must be documented using **TSDoc** to ensure clarity and maintainability.
Example:
```ts
/**
* Represents a user profile in the system.
*/
export interface UserProfile {
/** The unique identifier for the user */
id: string;
/** The user's display name */
name: string;
}
/**
* Parameters for fetching a collection list.
*/
export interface GetCollectionListParams {
/** Current page number (1-based indexing) */
page: number;
/** Number of items to display per page */
page_size: number;
/** When true, returns only collections shared with the current user */
shared_with_me?: boolean;
/** When true, returns only collections owned by the current user */
owned_by_me?: boolean;
}
```
## Usage
These namespace types will be imported into the following locations:
- `/src/api/buster_rest/*`
- `/src/api/buster_socket/*`
- `/src/api/buster_socket_query/*`
Ensure that all types are properly imported and used to maintain consistency across the codebase.