"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.metadata=void 0;const db_1=require("@b/db"),query_1=require("@b/utils/query");exports.metadata={summary:"Lists all permissions",operationId:"listPermissions",tags:["Admin","CRM","Permission"],logModule:"ADMIN_CRM",logTitle:"Get permission options",responses:{200:{description:"List of permissions",content:{"application/json":{schema:{type:"array",items:{type:"object",properties:{id:{type:"string",description:"ID of the permission"},name:{type:"string",description:"Name of the permission"}}}}}}},401:query_1.unauthorizedResponse,404:(0,query_1.notFoundMetadataResponse)("Permissions"),500:query_1.serverErrorResponse},requiresAuth:!0};exports.default=async e=>{const{ctx:s}=e;null==s||s.step("Fetching permission options");const i=await db_1.models.permission.findAll({order:[["name","ASC"]]});null==s||s.success("Permission options retrieved successfully");return i};