// A live list of the tenant's articles. Useful next to the search box to show // the full set; the search.query rpc (synthesized by searchPlugin) is what you // hit for a query string. tenant() scopes both to the caller automatically. import { defineQuery } from '@voltro/protocol' import { Schema } from 'effect' export const listArticles = defineQuery({ name: 'articles.list', // Open: the rows are this template's own seeded demo articles // (`seeds/articles.seed.ts`), and `tenant()` confines every delivery to the // tenantId on the request. No auth strategy and no rbac ship here, so a // `guards: [{ scope }]` would be unsatisfiable and deny 100% of traffic. // // The plugin's own `search.query` procedure is a SEPARATE surface with its // own decision, made by the plugin — this line covers only the list. openAccess: 'lists the request tenant\'s seeded demo articles (`tenant()` scopes every delivery); the ' + 'seed holds no personal data. No auth strategy ships here, so the tenant comes from the ' + 'caller\'s `x-tenant` header.', input: Schema.Struct({}), output: Schema.Array( Schema.Struct({ id: Schema.String, title: Schema.String, body: Schema.String, tag: Schema.String, tenantId: Schema.String, createdAt: Schema.Date, }), ), })