mirror of https://github.com/buster-so/buster.git
Get report
This commit is contained in:
parent
b3b759bd26
commit
1a955d786b
|
@ -0,0 +1,2 @@
|
|||
ALTER TYPE "public"."asset_type_enum" ADD VALUE 'report_file';--> statement-breakpoint
|
||||
ALTER TABLE "asset_search" ALTER COLUMN "asset_type" SET DATA TYPE "public"."asset_type_enum" USING "asset_type"::"public"."asset_type_enum";
|
File diff suppressed because it is too large
Load Diff
|
@ -603,6 +603,13 @@
|
|||
"when": 1754337436368,
|
||||
"tag": "0085_create_report_table",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 86,
|
||||
"version": "7",
|
||||
"when": 1754342648525,
|
||||
"tag": "0086_report_table_enum_update",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,7 +1,13 @@
|
|||
import { and, eq, isNull } from 'drizzle-orm';
|
||||
import { z } from 'zod';
|
||||
import { db } from '../../connection';
|
||||
import { assetPermissions, collections, collectionsToAssets, reportFiles, users } from '../../schema';
|
||||
import {
|
||||
assetPermissions,
|
||||
collections,
|
||||
collectionsToAssets,
|
||||
reportFiles,
|
||||
users,
|
||||
} from '../../schema';
|
||||
import { getUserOrganizationId } from '../organizations';
|
||||
|
||||
export const GetReportInputSchema = z.object({
|
||||
|
@ -90,11 +96,8 @@ export async function getReport(input: GetReportInput) {
|
|||
)
|
||||
);
|
||||
|
||||
const [reportDataResult, reportCollectionsResult, individualPermissionsResult] = await Promise.all([
|
||||
reportDataQuery,
|
||||
reportCollectionsQuery,
|
||||
individualPermissionsQuery,
|
||||
]);
|
||||
const [reportDataResult, reportCollectionsResult, individualPermissionsResult] =
|
||||
await Promise.all([reportDataQuery, reportCollectionsQuery, individualPermissionsQuery]);
|
||||
const reportData = reportDataResult[0];
|
||||
|
||||
if (!reportData) {
|
||||
|
@ -117,6 +120,7 @@ export async function getReport(input: GetReportInput) {
|
|||
version_number: versionHistoryArray[versionHistoryArray.length - 1]?.version_number ?? 1,
|
||||
version_history: versionHistoryArray,
|
||||
collections: reportCollectionsResult,
|
||||
individual_permissions: individualPermissionsResult,
|
||||
};
|
||||
|
||||
return report;
|
||||
|
|
|
@ -470,7 +470,7 @@ export const assetSearch = pgTable(
|
|||
{
|
||||
id: uuid().defaultRandom().primaryKey().notNull(),
|
||||
assetId: uuid('asset_id').notNull(),
|
||||
assetType: text('asset_type').notNull(),
|
||||
assetType: assetTypeEnum('asset_type').notNull(),
|
||||
content: text().notNull(),
|
||||
organizationId: uuid('organization_id').notNull(),
|
||||
createdAt: timestamp('created_at', { withTimezone: true, mode: 'string' })
|
||||
|
|
Loading…
Reference in New Issue