nocodo icon indicating copy to clipboard operation
nocodo copied to clipboard

feat(api): Add endpoint for browser extension feedback

Open brainless opened this issue 4 months ago • 0 comments

Summary

To support the new browser extension, a new API endpoint must be added to the nocodo-manager daemon. This endpoint will receive and store the feedback submitted by users from the extension.

API Endpoint Specification

  • Route: POST /api/v1/projects/{project_id}/feedback
  • Method: POST
  • Payload: A JSON object containing the feedback details.

Data Model

A new Rust struct should be defined to represent the incoming data, and ts-rs should be used to generate the corresponding TypeScript type.

Rust Struct (manager/src/models.rs):

#[derive(serde::Serialize, serde::Deserialize, ts_rs::TS)]
#[ts(export)]
pub struct BrowserFeedback {
    pub comment: String,
    pub selector: String,
    pub url: String,
    pub timestamp: chrono::DateTime<chrono::Utc>,
}

Generated TypeScript (manager/bindings/BrowserFeedback.ts):

export interface BrowserFeedback { comment: string, selector: string, url: string, timestamp: string, }

Implementation Details

  • A new handler function needs to be created in manager/src/handlers.rs.
  • This handler will be responsible for parsing the request, validating the data, and storing it in the SQLite database. This may require a new database table and updates to manager/src/database.rs.

Affected Files

  • manager/src/handlers.rs
  • manager/src/models.rs
  • manager/src/database.rs
  • manager/src/lib.rs (to wire up the new route)
  • manager/bindings/ (for the generated TypeScript type)

brainless avatar Aug 26 '25 04:08 brainless