feat(cc-052): add financialSignals table to schema
This commit is contained in:
parent
46a152dd13
commit
2408925264
1 changed files with 33 additions and 0 deletions
|
|
@ -622,3 +622,36 @@ export const researchBriefs = pgTable('research_briefs', {
|
||||||
createdAt: timestamp('created_at').defaultNow().notNull(),
|
createdAt: timestamp('created_at').defaultNow().notNull(),
|
||||||
updatedAt: timestamp('updated_at').defaultNow().notNull(),
|
updatedAt: timestamp('updated_at').defaultNow().notNull(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// ── Financial Intelligence (CC-052) ─────────────────────────────────────────
|
||||||
|
// Semnale macro/FX/rates/news ingerate din n8n (World Bank, IMF, Eurostat).
|
||||||
|
export const financialSignals = pgTable(
|
||||||
|
'financial_signals',
|
||||||
|
{
|
||||||
|
id: uuid('id').defaultRandom().primaryKey(),
|
||||||
|
tenantId: uuid('tenant_id'),
|
||||||
|
/** macro | fx | rates | news | commodity */
|
||||||
|
category: text('category').notNull().default('macro'),
|
||||||
|
/** global | eu | ro | de | us */
|
||||||
|
region: text('region').notNull().default('global'),
|
||||||
|
/** null = se aplica tuturor nișelor */
|
||||||
|
niche: text('niche'),
|
||||||
|
source: text('source').notNull(),
|
||||||
|
indicatorCode: text('indicator_code'),
|
||||||
|
title: text('title').notNull(),
|
||||||
|
/** Rezumat generat de AI per nișă */
|
||||||
|
summary: text('summary').notNull(),
|
||||||
|
rawValue: numeric('raw_value', { precision: 18, scale: 4 }),
|
||||||
|
changePercent: numeric('change_percent', { precision: 10, scale: 4 }),
|
||||||
|
unit: text('unit'),
|
||||||
|
/** info | warning | critical */
|
||||||
|
severity: text('severity').notNull().default('info'),
|
||||||
|
publishedAt: timestamp('published_at').defaultNow().notNull(),
|
||||||
|
expiresAt: timestamp('expires_at'),
|
||||||
|
createdAt: timestamp('created_at').defaultNow().notNull(),
|
||||||
|
},
|
||||||
|
(t) => [
|
||||||
|
index('financial_signals_published_idx').on(t.category, t.publishedAt),
|
||||||
|
index('financial_signals_tenant_idx').on(t.tenantId, t.publishedAt),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue