@squidcloud/backend
    Preparing search index...

    Function secureCollection

    • Decorator that marks a function for securing a collection inside a database. The decorator takes the collection, type of action, and an optional integration ID. If no integration ID is provided, the built_in_db integration is used.

      The function should return a boolean or a Promise of a boolean indicating whether the action is allowed. In addition, depending on the action, the function can take a context object as a parameter. The context object contains information about the action.

      To read more about securing a collection rules, see the documentation.

      Type Parameters

      • T extends DatabaseActionType

      Parameters

      • collectionName: string

        The name of the collection to secure.

      • type: T

        The type of action to secure.

      • OptionalintegrationId: string

        The ID of the integration to secure.

      Returns ActionMethodDecorator<SecureDatabaseAction<T>>