- Introduced a comprehensive report engine for generating and managing reports, including sales and logistics reports. - Added new API endpoints for retrieving report configurations, data, and metadata, ensuring secure access with privilege checks. - Implemented a report bookmarks system to allow users to save and manage report filters and configurations. - Created database migrations for the `report_bookmarks` table and updated the schema to support new report functionalities. - Developed services and controllers for handling report queries and bookmarks, including CRUD operations for bookmarks. - Enhanced API documentation to reflect the new reporting features and endpoints. - Added unit and integration tests to validate the new functionalities and ensure data integrity across report operations.
22 lines
1.2 KiB
SQL
22 lines
1.2 KiB
SQL
CREATE TABLE "report_bookmarks" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"group_name" text NOT NULL,
|
|
"unique_name" text NOT NULL,
|
|
"label" text NOT NULL,
|
|
"type" text NOT NULL,
|
|
"applied" boolean DEFAULT false NOT NULL,
|
|
"configuration" jsonb NOT NULL,
|
|
"status" text DEFAULT 'draft' NOT NULL,
|
|
"created_at" bigint NOT NULL,
|
|
"updated_at" bigint NOT NULL,
|
|
"created_by" uuid NOT NULL,
|
|
"updated_by" uuid NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
ALTER TABLE "report_bookmarks" ADD CONSTRAINT "report_bookmarks_created_by_users_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
ALTER TABLE "report_bookmarks" ADD CONSTRAINT "report_bookmarks_updated_by_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
CREATE UNIQUE INDEX "report_bookmarks_owner_report_type_applied_unique" ON "report_bookmarks" USING btree ("created_by","group_name","unique_name","type") WHERE "applied" = true;--> statement-breakpoint
|
|
INSERT INTO "privilege_keys" ("code", "label", "sort_order") VALUES
|
|
('SALES.REPORT', 'Sales reports', 18),
|
|
('LOGISTICS.REPORT', 'Logistics reports', 19);
|