gatex
    Preparing search index...

    Interface IRepository

    Defines the structure for a resource repository managed by GatEX. By implementing this interface, GatEX can automatically map its methods to standard RESTful HTTP routes.

    import { IRepository } from 'gatex';

    @PathName("posts")
    export class PostRepository implements IRepository {
    // ... method implementations
    }
    interface IRepository {
        create?: (req: Request, res: Response) => void | Promise<void>;
        delete?: (req: Request, res: Response) => void | Promise<void>;
        get?: (req: Request, res: Response) => void | Promise<void>;
        list?: (req: Request, res: Response) => void | Promise<void>;
        patch?: (req: Request, res: Response) => void | Promise<void>;
        update?: (req: Request, res: Response) => void | Promise<void>;
    }
    Index

    Properties

    create?: (req: Request, res: Response) => void | Promise<void>

    Mapped to POST /{pathName}. Used to create a new resource. The request body (req.body) is the intended source for creation data.

    delete?: (req: Request, res: Response) => void | Promise<void>

    Mapped to DELETE /{pathName}/:{idParam}. Used to delete a specific resource by its ID.

    get?: (req: Request, res: Response) => void | Promise<void>

    Mapped to GET /{pathName}/:{idParam}. Used to retrieve a single resource by its ID. The ID will be available in req.params.

    list?: (req: Request, res: Response) => void | Promise<void>

    Mapped to GET /{pathName}. Used to list a collection of resources. Schema validation typically applies to req.query for filtering and pagination.

    patch?: (req: Request, res: Response) => void | Promise<void>

    Mapped to PATCH /{pathName}/:{idParam}. Used to partially update an existing resource. The request body (req.body) should contain only the fields to be updated.

    update?: (req: Request, res: Response) => void | Promise<void>

    Mapped to PUT /{pathName}/:{idParam}. Used to completely replace an existing resource. The request body (req.body) should contain the full resource representation.