fix: preserve value types in extraFields (no string coercion)
CI / typecheck + build (turbo) (push) Canceled after 0s

- DocumentMeta.extraFields type -> Record<string, unknown>
- API routes pass extraFields through without JSON.stringify coercion
- CustomFieldBadges auto-styles by value type/content (number->purple, boolean->green/red, etc.)
- DocForm help text: generic (no hardcoded field examples)
This commit is contained in:
asepharyana
2026-08-21 00:45:32 +07:00
parent edbd812c30
commit ceb53adba4
5 changed files with 27 additions and 14 deletions
+2 -2
View File
@@ -128,7 +128,7 @@ export interface CreateDocInput {
status?: DocStatus;
author?: string;
tags?: string[];
extraFields?: Record<string, string>;
extraFields?: Record<string, unknown>;
}
export interface UpdateDocInput {
@@ -138,7 +138,7 @@ export interface UpdateDocInput {
status?: DocStatus;
tags?: string[];
author?: string;
extraFields?: Record<string, string>;
extraFields?: Record<string, unknown>;
}
/** Validate that a slug is safe (no path traversal, only [a-z0-9/_-]). */
+2 -1
View File
@@ -16,7 +16,8 @@ export interface DocumentMeta {
updatedAt: string; // ISO
// Dynamic custom frontmatter fields (e.g. CTF: event, challenge, category,
// difficulty, points). Content creators add arbitrary key-value pairs.
extraFields?: Record<string, string>;
// Values can be strings, numbers, booleans, arrays, or objects.
extraFields?: Record<string, unknown>;
}
export interface Document extends DocumentMeta {