mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-18 08:02:12 +00:00
style: apply prettier across the tree
One-shot prettier pass so the new format:check gate starts from a clean baseline. Formatting only — no behaviour change. Generator-owned and vendored artifacts stay untouched via .prettierignore.
This commit is contained in:
1 parent
b3fea2ef59
commit
1f4ba5939d
1000 files changed
+12130
-8385
No files matched your search
@@ -47,18 +47,34 @@ describe("custom-tag helpers", () => {
|
||||
|
||||
describe("custom-tag schemas", () => {
|
||||
it("accepts a valid create and rejects a bad icon / empty / over-long label", () => {
|
||||
expect(createCustomTagSchema.safeParse({ label: "Date night", icon: "Heart" }).success).toBe(true);
|
||||
expect(createCustomTagSchema.safeParse({ label: " ok " }).success).toBe(true);
|
||||
expect(createCustomTagSchema.safeParse({ label: "x", icon: "NotAnIcon" }).success).toBe(false);
|
||||
expect(
|
||||
createCustomTagSchema.safeParse({ label: "Date night", icon: "Heart" })
|
||||
.success,
|
||||
).toBe(true);
|
||||
expect(createCustomTagSchema.safeParse({ label: " ok " }).success).toBe(
|
||||
true,
|
||||
);
|
||||
expect(
|
||||
createCustomTagSchema.safeParse({ label: "x", icon: "NotAnIcon" })
|
||||
.success,
|
||||
).toBe(false);
|
||||
expect(createCustomTagSchema.safeParse({ label: "" }).success).toBe(false);
|
||||
expect(createCustomTagSchema.safeParse({ label: "a".repeat(41) }).success).toBe(false);
|
||||
expect(
|
||||
createCustomTagSchema.safeParse({ label: "a".repeat(41) }).success,
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("requires at least one field on update and validates hidden flag", () => {
|
||||
expect(updateCustomTagSchema.safeParse({}).success).toBe(false);
|
||||
expect(updateCustomTagSchema.safeParse({ isActive: false }).success).toBe(true);
|
||||
expect(hideCatalogueTagSchema.safeParse({ hidden: true }).success).toBe(true);
|
||||
expect(hideCatalogueTagSchema.safeParse({ hidden: "yes" }).success).toBe(false);
|
||||
expect(updateCustomTagSchema.safeParse({ isActive: false }).success).toBe(
|
||||
true,
|
||||
);
|
||||
expect(hideCatalogueTagSchema.safeParse({ hidden: true }).success).toBe(
|
||||
true,
|
||||
);
|
||||
expect(hideCatalogueTagSchema.safeParse({ hidden: "yes" }).success).toBe(
|
||||
false,
|
||||
);
|
||||
});
|
||||
|
||||
it("accepts a categoryKey on create + update (v1.17.0) within bounds", () => {
|
||||
@@ -99,19 +115,27 @@ describe("custom-group helpers + schemas (v1.17.0)", () => {
|
||||
});
|
||||
|
||||
it("validates group create / update bodies like the tag schemas", () => {
|
||||
expect(createCustomGroupSchema.safeParse({ label: "Hobbies 2" }).success).toBe(true);
|
||||
expect(
|
||||
createCustomGroupSchema.safeParse({ label: "x", icon: "Stethoscope" }).success,
|
||||
createCustomGroupSchema.safeParse({ label: "Hobbies 2" }).success,
|
||||
).toBe(true);
|
||||
expect(
|
||||
createCustomGroupSchema.safeParse({ label: "x", icon: "NotAnIcon" }).success,
|
||||
createCustomGroupSchema.safeParse({ label: "x", icon: "Stethoscope" })
|
||||
.success,
|
||||
).toBe(true);
|
||||
expect(
|
||||
createCustomGroupSchema.safeParse({ label: "x", icon: "NotAnIcon" })
|
||||
.success,
|
||||
).toBe(false);
|
||||
expect(createCustomGroupSchema.safeParse({ label: "" }).success).toBe(false);
|
||||
expect(createCustomGroupSchema.safeParse({ label: "" }).success).toBe(
|
||||
false,
|
||||
);
|
||||
expect(
|
||||
createCustomGroupSchema.safeParse({ label: "a".repeat(41) }).success,
|
||||
).toBe(false);
|
||||
expect(updateCustomGroupSchema.safeParse({}).success).toBe(false);
|
||||
expect(updateCustomGroupSchema.safeParse({ isActive: false }).success).toBe(true);
|
||||
expect(updateCustomGroupSchema.safeParse({ isActive: false }).success).toBe(
|
||||
true,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -123,9 +147,28 @@ describe("icon catalog → allowlist seam (v1.17.0)", () => {
|
||||
// The v1.13 22-name allowlist must survive — icons already stored on
|
||||
// rows keep validating.
|
||||
const legacy = [
|
||||
"Tag", "Heart", "Smile", "Frown", "Dumbbell", "Moon", "Sun", "Wine",
|
||||
"Coffee", "House", "Briefcase", "Book", "Music", "Plane", "Car",
|
||||
"Users", "Pill", "Activity", "Brain", "Cloud", "Star", "Zap",
|
||||
"Tag",
|
||||
"Heart",
|
||||
"Smile",
|
||||
"Frown",
|
||||
"Dumbbell",
|
||||
"Moon",
|
||||
"Sun",
|
||||
"Wine",
|
||||
"Coffee",
|
||||
"House",
|
||||
"Briefcase",
|
||||
"Book",
|
||||
"Music",
|
||||
"Plane",
|
||||
"Car",
|
||||
"Users",
|
||||
"Pill",
|
||||
"Activity",
|
||||
"Brain",
|
||||
"Cloud",
|
||||
"Star",
|
||||
"Zap",
|
||||
];
|
||||
for (const name of legacy) {
|
||||
expect(CUSTOM_TAG_ICON_ALLOWLIST).toContain(name);
|
||||
|
||||
@@ -5,7 +5,9 @@ import { extractNoteAndSlimTags } from "../note-backfill";
|
||||
describe("extractNoteAndSlimTags", () => {
|
||||
it("extracts the first note:<text> entry and slims the tag array", () => {
|
||||
expect(
|
||||
extractNoteAndSlimTags(JSON.stringify(["coffee", "note:slept poorly", "workout"])),
|
||||
extractNoteAndSlimTags(
|
||||
JSON.stringify(["coffee", "note:slept poorly", "workout"]),
|
||||
),
|
||||
).toEqual({
|
||||
note: "slept poorly",
|
||||
newTags: JSON.stringify(["coffee", "workout"]),
|
||||
@@ -13,14 +15,18 @@ describe("extractNoteAndSlimTags", () => {
|
||||
});
|
||||
|
||||
it("returns null tags when the slimmed array is empty", () => {
|
||||
expect(extractNoteAndSlimTags(JSON.stringify(["note:lonely entry"]))).toEqual({
|
||||
expect(
|
||||
extractNoteAndSlimTags(JSON.stringify(["note:lonely entry"])),
|
||||
).toEqual({
|
||||
note: "lonely entry",
|
||||
newTags: null,
|
||||
});
|
||||
});
|
||||
|
||||
it("returns note=null when no entry starts with note:", () => {
|
||||
expect(extractNoteAndSlimTags(JSON.stringify(["coffee", "workout"]))).toEqual({
|
||||
expect(
|
||||
extractNoteAndSlimTags(JSON.stringify(["coffee", "workout"])),
|
||||
).toEqual({
|
||||
note: null,
|
||||
newTags: JSON.stringify(["coffee", "workout"]),
|
||||
});
|
||||
|
||||
@@ -39,7 +39,12 @@ describe("moodTagLayoutSchema bounds", () => {
|
||||
).toBe(false);
|
||||
expect(
|
||||
moodTagLayoutSchema.safeParse({
|
||||
placements: { g1: Array.from({ length: MOOD_TAG_LAYOUT_MAX_PLACEMENTS + 1 }, (_, i) => `t${i}`) },
|
||||
placements: {
|
||||
g1: Array.from(
|
||||
{ length: MOOD_TAG_LAYOUT_MAX_PLACEMENTS + 1 },
|
||||
(_, i) => `t${i}`,
|
||||
),
|
||||
},
|
||||
}).success,
|
||||
).toBe(false);
|
||||
expect(
|
||||
@@ -56,7 +61,9 @@ describe("parseStoredMoodTagLayout", () => {
|
||||
expect(parseStoredMoodTagLayout(null)).toEqual({});
|
||||
expect(parseStoredMoodTagLayout(undefined)).toEqual({});
|
||||
expect(parseStoredMoodTagLayout("garbage")).toEqual({});
|
||||
expect(parseStoredMoodTagLayout({ groupOrder: "not-an-array" })).toEqual({});
|
||||
expect(parseStoredMoodTagLayout({ groupOrder: "not-an-array" })).toEqual(
|
||||
{},
|
||||
);
|
||||
expect(parseStoredMoodTagLayout({ groupOrder: ["a"] })).toEqual({
|
||||
groupOrder: ["a"],
|
||||
});
|
||||
|
||||
@@ -106,7 +106,9 @@ describe("createTagLinks with rated factors", () => {
|
||||
]);
|
||||
expect(linkCreateMany).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
data: [{ moodEntryId: "entry-1", moodTagId: "mt_factor_work", rating: 5 }],
|
||||
data: [
|
||||
{ moodEntryId: "entry-1", moodTagId: "mt_factor_work", rating: 5 },
|
||||
],
|
||||
}),
|
||||
);
|
||||
});
|
||||
@@ -163,7 +165,10 @@ describe("replaceTagLinks — archived-tag links survive an entry edit", () => {
|
||||
});
|
||||
|
||||
it("removes an active tag the body dropped", async () => {
|
||||
linkFindMany.mockResolvedValue([link("mt_happy", true), link("mt_tired", true)]);
|
||||
linkFindMany.mockResolvedValue([
|
||||
link("mt_happy", true),
|
||||
link("mt_tired", true),
|
||||
]);
|
||||
moodTagFindMany.mockResolvedValue([{ id: "mt_happy" }]);
|
||||
|
||||
await replaceTagLinks("entry-1", "user-1", ["happy"]);
|
||||
|
||||
+245
-49
@@ -43,81 +43,277 @@ export const MOOD_TAG_ICON_CATALOG: readonly MoodTagIconCatalogEntry[] = [
|
||||
// ── emotions ─────────────────────────────────────────────────────────
|
||||
{ name: "Smile", keywords: ["happy", "good", "content"], group: "emotions" },
|
||||
{ name: "Laugh", keywords: ["joy", "fun", "laughter"], group: "emotions" },
|
||||
{ name: "Meh", keywords: ["neutral", "okay", "indifferent"], group: "emotions" },
|
||||
{
|
||||
name: "Meh",
|
||||
keywords: ["neutral", "okay", "indifferent"],
|
||||
group: "emotions",
|
||||
},
|
||||
{ name: "Frown", keywords: ["sad", "down", "unhappy"], group: "emotions" },
|
||||
{ name: "Angry", keywords: ["mad", "anger", "frustration"], group: "emotions" },
|
||||
{
|
||||
name: "Angry",
|
||||
keywords: ["mad", "anger", "frustration"],
|
||||
group: "emotions",
|
||||
},
|
||||
{ name: "Heart", keywords: ["love", "romance", "date"], group: "emotions" },
|
||||
{ name: "HandHeart", keywords: ["kindness", "gratitude", "care"], group: "emotions" },
|
||||
{ name: "PartyPopper", keywords: ["party", "celebration", "birthday"], group: "emotions" },
|
||||
{
|
||||
name: "HandHeart",
|
||||
keywords: ["kindness", "gratitude", "care"],
|
||||
group: "emotions",
|
||||
},
|
||||
{
|
||||
name: "PartyPopper",
|
||||
keywords: ["party", "celebration", "birthday"],
|
||||
group: "emotions",
|
||||
},
|
||||
{ name: "ThumbsUp", keywords: ["good", "win", "approve"], group: "emotions" },
|
||||
{ name: "CheckCircle", keywords: ["done", "achievement", "complete"], group: "emotions" },
|
||||
{ name: "AlertTriangle", keywords: ["stress", "warning", "alert"], group: "emotions" },
|
||||
{ name: "HelpCircle", keywords: ["uncertainty", "confusion", "question"], group: "emotions" },
|
||||
{ name: "Swords", keywords: ["conflict", "argument", "fight"], group: "emotions" },
|
||||
{ name: "Flame", keywords: ["energy", "motivation", "streak"], group: "emotions" },
|
||||
{
|
||||
name: "CheckCircle",
|
||||
keywords: ["done", "achievement", "complete"],
|
||||
group: "emotions",
|
||||
},
|
||||
{
|
||||
name: "AlertTriangle",
|
||||
keywords: ["stress", "warning", "alert"],
|
||||
group: "emotions",
|
||||
},
|
||||
{
|
||||
name: "HelpCircle",
|
||||
keywords: ["uncertainty", "confusion", "question"],
|
||||
group: "emotions",
|
||||
},
|
||||
{
|
||||
name: "Swords",
|
||||
keywords: ["conflict", "argument", "fight"],
|
||||
group: "emotions",
|
||||
},
|
||||
{
|
||||
name: "Flame",
|
||||
keywords: ["energy", "motivation", "streak"],
|
||||
group: "emotions",
|
||||
},
|
||||
{ name: "Zap", keywords: ["energy", "electric", "boost"], group: "emotions" },
|
||||
{ name: "Star", keywords: ["favorite", "special", "highlight"], group: "emotions" },
|
||||
{ name: "Gift", keywords: ["present", "surprise", "birthday"], group: "emotions" },
|
||||
{
|
||||
name: "Star",
|
||||
keywords: ["favorite", "special", "highlight"],
|
||||
group: "emotions",
|
||||
},
|
||||
{
|
||||
name: "Gift",
|
||||
keywords: ["present", "surprise", "birthday"],
|
||||
group: "emotions",
|
||||
},
|
||||
|
||||
// ── activities ───────────────────────────────────────────────────────
|
||||
{ name: "Dumbbell", keywords: ["gym", "workout", "strength"], group: "activities" },
|
||||
{ name: "Activity", keywords: ["exercise", "pulse", "movement"], group: "activities" },
|
||||
{ name: "Footprints", keywords: ["walk", "steps", "stroll"], group: "activities" },
|
||||
{ name: "Bike", keywords: ["cycling", "bicycle", "ride"], group: "activities" },
|
||||
{ name: "Music", keywords: ["concert", "song", "instrument"], group: "activities" },
|
||||
{ name: "Headphones", keywords: ["podcast", "listening", "audio"], group: "activities" },
|
||||
{ name: "Gamepad2", keywords: ["gaming", "videogame", "play"], group: "activities" },
|
||||
{ name: "Film", keywords: ["movie", "cinema", "series"], group: "activities" },
|
||||
{ name: "BookOpen", keywords: ["reading", "book", "novel"], group: "activities" },
|
||||
{ name: "Book", keywords: ["journal", "study", "diary"], group: "activities" },
|
||||
{ name: "Briefcase", keywords: ["work", "office", "job"], group: "activities" },
|
||||
{ name: "GraduationCap", keywords: ["school", "study", "learning"], group: "activities" },
|
||||
{ name: "Palette", keywords: ["art", "creative", "painting"], group: "activities" },
|
||||
{ name: "Camera", keywords: ["photo", "photography", "picture"], group: "activities" },
|
||||
{ name: "Trees", keywords: ["nature", "outdoors", "forest"], group: "activities" },
|
||||
{ name: "Mountain", keywords: ["hike", "climbing", "summit"], group: "activities" },
|
||||
{ name: "Plane", keywords: ["travel", "flight", "vacation"], group: "activities" },
|
||||
{
|
||||
name: "Dumbbell",
|
||||
keywords: ["gym", "workout", "strength"],
|
||||
group: "activities",
|
||||
},
|
||||
{
|
||||
name: "Activity",
|
||||
keywords: ["exercise", "pulse", "movement"],
|
||||
group: "activities",
|
||||
},
|
||||
{
|
||||
name: "Footprints",
|
||||
keywords: ["walk", "steps", "stroll"],
|
||||
group: "activities",
|
||||
},
|
||||
{
|
||||
name: "Bike",
|
||||
keywords: ["cycling", "bicycle", "ride"],
|
||||
group: "activities",
|
||||
},
|
||||
{
|
||||
name: "Music",
|
||||
keywords: ["concert", "song", "instrument"],
|
||||
group: "activities",
|
||||
},
|
||||
{
|
||||
name: "Headphones",
|
||||
keywords: ["podcast", "listening", "audio"],
|
||||
group: "activities",
|
||||
},
|
||||
{
|
||||
name: "Gamepad2",
|
||||
keywords: ["gaming", "videogame", "play"],
|
||||
group: "activities",
|
||||
},
|
||||
{
|
||||
name: "Film",
|
||||
keywords: ["movie", "cinema", "series"],
|
||||
group: "activities",
|
||||
},
|
||||
{
|
||||
name: "BookOpen",
|
||||
keywords: ["reading", "book", "novel"],
|
||||
group: "activities",
|
||||
},
|
||||
{
|
||||
name: "Book",
|
||||
keywords: ["journal", "study", "diary"],
|
||||
group: "activities",
|
||||
},
|
||||
{
|
||||
name: "Briefcase",
|
||||
keywords: ["work", "office", "job"],
|
||||
group: "activities",
|
||||
},
|
||||
{
|
||||
name: "GraduationCap",
|
||||
keywords: ["school", "study", "learning"],
|
||||
group: "activities",
|
||||
},
|
||||
{
|
||||
name: "Palette",
|
||||
keywords: ["art", "creative", "painting"],
|
||||
group: "activities",
|
||||
},
|
||||
{
|
||||
name: "Camera",
|
||||
keywords: ["photo", "photography", "picture"],
|
||||
group: "activities",
|
||||
},
|
||||
{
|
||||
name: "Trees",
|
||||
keywords: ["nature", "outdoors", "forest"],
|
||||
group: "activities",
|
||||
},
|
||||
{
|
||||
name: "Mountain",
|
||||
keywords: ["hike", "climbing", "summit"],
|
||||
group: "activities",
|
||||
},
|
||||
{
|
||||
name: "Plane",
|
||||
keywords: ["travel", "flight", "vacation"],
|
||||
group: "activities",
|
||||
},
|
||||
{ name: "Car", keywords: ["drive", "commute", "road"], group: "activities" },
|
||||
{ name: "ShoppingCart", keywords: ["shopping", "groceries", "errands"], group: "activities" },
|
||||
{ name: "Phone", keywords: ["call", "telephone", "contact"], group: "activities" },
|
||||
{ name: "Users", keywords: ["friends", "social", "family"], group: "activities" },
|
||||
{
|
||||
name: "ShoppingCart",
|
||||
keywords: ["shopping", "groceries", "errands"],
|
||||
group: "activities",
|
||||
},
|
||||
{
|
||||
name: "Phone",
|
||||
keywords: ["call", "telephone", "contact"],
|
||||
group: "activities",
|
||||
},
|
||||
{
|
||||
name: "Users",
|
||||
keywords: ["friends", "social", "family"],
|
||||
group: "activities",
|
||||
},
|
||||
{ name: "User", keywords: ["alone", "solo", "me"], group: "activities" },
|
||||
{ name: "LogOut", keywords: ["out", "leave", "going out"], group: "activities" },
|
||||
{ name: "Banknote", keywords: ["money", "finance", "spending"], group: "activities" },
|
||||
{ name: "Clock", keywords: ["time", "late", "schedule"], group: "activities" },
|
||||
{ name: "SlidersHorizontal", keywords: ["adjust", "factor", "balance"], group: "activities" },
|
||||
{
|
||||
name: "LogOut",
|
||||
keywords: ["out", "leave", "going out"],
|
||||
group: "activities",
|
||||
},
|
||||
{
|
||||
name: "Banknote",
|
||||
keywords: ["money", "finance", "spending"],
|
||||
group: "activities",
|
||||
},
|
||||
{
|
||||
name: "Clock",
|
||||
keywords: ["time", "late", "schedule"],
|
||||
group: "activities",
|
||||
},
|
||||
{
|
||||
name: "SlidersHorizontal",
|
||||
keywords: ["adjust", "factor", "balance"],
|
||||
group: "activities",
|
||||
},
|
||||
|
||||
// ── health ───────────────────────────────────────────────────────────
|
||||
{ name: "Pill", keywords: ["medication", "medicine", "dose"], group: "health" },
|
||||
{ name: "Stethoscope", keywords: ["doctor", "appointment", "checkup"], group: "health" },
|
||||
{ name: "Syringe", keywords: ["injection", "vaccine", "shot"], group: "health" },
|
||||
{ name: "Thermometer", keywords: ["fever", "sick", "temperature"], group: "health" },
|
||||
{ name: "HeartPulse", keywords: ["heart rate", "cardio", "pulse"], group: "health" },
|
||||
{
|
||||
name: "Pill",
|
||||
keywords: ["medication", "medicine", "dose"],
|
||||
group: "health",
|
||||
},
|
||||
{
|
||||
name: "Stethoscope",
|
||||
keywords: ["doctor", "appointment", "checkup"],
|
||||
group: "health",
|
||||
},
|
||||
{
|
||||
name: "Syringe",
|
||||
keywords: ["injection", "vaccine", "shot"],
|
||||
group: "health",
|
||||
},
|
||||
{
|
||||
name: "Thermometer",
|
||||
keywords: ["fever", "sick", "temperature"],
|
||||
group: "health",
|
||||
},
|
||||
{
|
||||
name: "HeartPulse",
|
||||
keywords: ["heart rate", "cardio", "pulse"],
|
||||
group: "health",
|
||||
},
|
||||
{ name: "Brain", keywords: ["mental", "focus", "therapy"], group: "health" },
|
||||
{ name: "Bath", keywords: ["bath", "relax", "selfcare"], group: "health" },
|
||||
{ name: "Bed", keywords: ["rest", "nap", "lie down"], group: "health" },
|
||||
{ name: "BedDouble", keywords: ["sleep", "bedtime", "night"], group: "health" },
|
||||
{
|
||||
name: "BedDouble",
|
||||
keywords: ["sleep", "bedtime", "night"],
|
||||
group: "health",
|
||||
},
|
||||
{ name: "Moon", keywords: ["night", "sleep", "dark"], group: "health" },
|
||||
{ name: "MoonStar", keywords: ["deep sleep", "night", "dream"], group: "health" },
|
||||
{ name: "Cigarette", keywords: ["smoking", "tobacco", "nicotine"], group: "health" },
|
||||
{ name: "CigaretteOff", keywords: ["no smoking", "quit", "smoke-free"], group: "health" },
|
||||
{
|
||||
name: "MoonStar",
|
||||
keywords: ["deep sleep", "night", "dream"],
|
||||
group: "health",
|
||||
},
|
||||
{
|
||||
name: "Cigarette",
|
||||
keywords: ["smoking", "tobacco", "nicotine"],
|
||||
group: "health",
|
||||
},
|
||||
{
|
||||
name: "CigaretteOff",
|
||||
keywords: ["no smoking", "quit", "smoke-free"],
|
||||
group: "health",
|
||||
},
|
||||
{ name: "Baby", keywords: ["baby", "kids", "parenting"], group: "health" },
|
||||
|
||||
// ── food ─────────────────────────────────────────────────────────────
|
||||
{ name: "Apple", keywords: ["fruit", "healthy", "snack"], group: "food" },
|
||||
{ name: "Pizza", keywords: ["fastfood", "junk", "takeout"], group: "food" },
|
||||
{ name: "UtensilsCrossed", keywords: ["meal", "dinner", "restaurant"], group: "food" },
|
||||
{ name: "Coffee", keywords: ["caffeine", "espresso", "morning"], group: "food" },
|
||||
{
|
||||
name: "UtensilsCrossed",
|
||||
keywords: ["meal", "dinner", "restaurant"],
|
||||
group: "food",
|
||||
},
|
||||
{
|
||||
name: "Coffee",
|
||||
keywords: ["caffeine", "espresso", "morning"],
|
||||
group: "food",
|
||||
},
|
||||
{ name: "Wine", keywords: ["alcohol", "drinks", "glass"], group: "food" },
|
||||
{ name: "GlassWater", keywords: ["water", "hydration", "drink"], group: "food" },
|
||||
{
|
||||
name: "GlassWater",
|
||||
keywords: ["water", "hydration", "drink"],
|
||||
group: "food",
|
||||
},
|
||||
{ name: "CandyOff", keywords: ["no sugar", "diet", "sweets"], group: "food" },
|
||||
|
||||
// ── weather ──────────────────────────────────────────────────────────
|
||||
{ name: "Sun", keywords: ["sunny", "warm", "bright"], group: "weather" },
|
||||
{ name: "CloudSun", keywords: ["partly cloudy", "mild", "mixed"], group: "weather" },
|
||||
{
|
||||
name: "CloudSun",
|
||||
keywords: ["partly cloudy", "mild", "mixed"],
|
||||
group: "weather",
|
||||
},
|
||||
{ name: "Cloud", keywords: ["overcast", "grey", "cloudy"], group: "weather" },
|
||||
{ name: "CloudRain", keywords: ["rain", "wet", "storm"], group: "weather" },
|
||||
{ name: "CloudMoon", keywords: ["clear night", "evening", "dusk"], group: "weather" },
|
||||
{
|
||||
name: "CloudMoon",
|
||||
keywords: ["clear night", "evening", "dusk"],
|
||||
group: "weather",
|
||||
},
|
||||
{ name: "Leaf", keywords: ["autumn", "plant", "season"], group: "weather" },
|
||||
|
||||
// ── places ───────────────────────────────────────────────────────────
|
||||
|
||||
@@ -28,10 +28,7 @@ export const MOOD_TAG_LAYOUT_MAX_GROUPS = 50;
|
||||
/** Upper bound on placement tag keys summed across every group. */
|
||||
export const MOOD_TAG_LAYOUT_MAX_PLACEMENTS = 400;
|
||||
|
||||
const layoutKeySchema = z
|
||||
.string()
|
||||
.min(1)
|
||||
.max(MOOD_TAG_LAYOUT_KEY_MAX_LENGTH);
|
||||
const layoutKeySchema = z.string().min(1).max(MOOD_TAG_LAYOUT_KEY_MAX_LENGTH);
|
||||
|
||||
/**
|
||||
* PUT body / stored-blob schema. Both fields optional so a client can PUT
|
||||
@@ -43,9 +40,7 @@ export const moodTagLayoutSchema = z
|
||||
.array(layoutKeySchema)
|
||||
.max(MOOD_TAG_LAYOUT_MAX_GROUPS)
|
||||
.optional(),
|
||||
placements: z
|
||||
.record(layoutKeySchema, z.array(layoutKeySchema))
|
||||
.optional(),
|
||||
placements: z.record(layoutKeySchema, z.array(layoutKeySchema)).optional(),
|
||||
})
|
||||
.superRefine((value, ctx) => {
|
||||
if (!value.placements) return;
|
||||
|
||||
Reference in new issue
Block a user