import { Class , ReadModelFilterHooks , ReadModelInterface , RoleAccess } from '@boostercloud/framework-types' ; import { Booster } from '../booster' ; import { getPropertiesMetadata } from './metadata' ; param attributes export function ReadModel ( attributes ) { return ( readModelClass ) => { Booster . configureCurrentEnv ( ( config ) : void => { if ( config . readModels [ readModelClass . name ] ) { throw new Error ( `A read model called ${ readModelClass . name } is already registered.
        If you think that this is an error, try performing a clean build.` ) ; } config . readModels [ readModelClass . name ] = { class : readModelClass , properties : getPropertiesMetadata ( readModelClass ) , authorizedRoles : attributes . authorize , before : attributes . before ?? [ ] , } ; } ) ; } ; }