mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-11-08 05:03:39 +08:00
fix: default result filters not passing schema
also update migration to handle previous schema !nuf
This commit is contained in:
parent
6fdfb5849b
commit
38aa79a350
2 changed files with 8 additions and 2 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import { ResultFilters } from "@monkeytype/contracts/schemas/users";
|
||||
|
||||
const object: ResultFilters = {
|
||||
_id: "default-result-filters-id",
|
||||
_id: "default",
|
||||
name: "default result filters",
|
||||
pb: {
|
||||
no: true,
|
||||
|
|
|
|||
|
|
@ -24,7 +24,13 @@ export function mergeWithDefaultFilters(
|
|||
try {
|
||||
const merged = {} as ResultFilters;
|
||||
for (const groupKey of Misc.typedKeys(defaultResultFilters)) {
|
||||
if (groupKey === "_id" || groupKey === "name") {
|
||||
if (groupKey === "_id") {
|
||||
let id = filters[groupKey] ?? defaultResultFilters[groupKey];
|
||||
if (id === "default-result-filters-id" || id === "") {
|
||||
id = "default";
|
||||
}
|
||||
merged[groupKey] = id;
|
||||
} else if (groupKey === "name") {
|
||||
merged[groupKey] = filters[groupKey] ?? defaultResultFilters[groupKey];
|
||||
} else {
|
||||
// @ts-expect-error i cant figure this out
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue