mirror of
https://github.com/kjanat/livedash-node.git
synced 2026-01-16 16:32:08 +01:00
feat(sessions): add missing language, sortKey, and sortOrder filtering support
- Add language field with ISO 639-1 validation to sessionFilterSchema - Add sortKey enum with startTime, category, language, sentiment, sessionId options - Add sortOrder enum with asc/desc options - Update tRPC router to support new filtering and sorting parameters - Uncomment frontend code to enable full filtering functionality - Add comprehensive validation tests for new schema fields Resolves commented out filter options in app/dashboard/sessions/page.tsx lines 491-502
This commit is contained in:
@ -176,6 +176,36 @@ describe("Validation Schemas", () => {
|
||||
const data = { limit: 101 };
|
||||
expect(sessionFilterSchema.safeParse(data).success).toBe(false);
|
||||
});
|
||||
|
||||
it("should validate valid language code", () => {
|
||||
const data = { language: "en" };
|
||||
expect(sessionFilterSchema.safeParse(data).success).toBe(true);
|
||||
});
|
||||
|
||||
it("should invalidate invalid language code", () => {
|
||||
const data = { language: "invalid" };
|
||||
expect(sessionFilterSchema.safeParse(data).success).toBe(false);
|
||||
});
|
||||
|
||||
it("should validate valid sortKey", () => {
|
||||
const data = { sortKey: "startTime" };
|
||||
expect(sessionFilterSchema.safeParse(data).success).toBe(true);
|
||||
});
|
||||
|
||||
it("should invalidate invalid sortKey", () => {
|
||||
const data = { sortKey: "invalid" };
|
||||
expect(sessionFilterSchema.safeParse(data).success).toBe(false);
|
||||
});
|
||||
|
||||
it("should validate valid sortOrder", () => {
|
||||
const data = { sortOrder: "asc" };
|
||||
expect(sessionFilterSchema.safeParse(data).success).toBe(true);
|
||||
});
|
||||
|
||||
it("should invalidate invalid sortOrder", () => {
|
||||
const data = { sortOrder: "invalid" };
|
||||
expect(sessionFilterSchema.safeParse(data).success).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("companySettingsSchema", () => {
|
||||
|
||||
Reference in New Issue
Block a user