mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 23:21:08 +02:00
fix: type errors from ManaCore→Mana rename and stale templates
- shared-branding/mana-apps: drop duplicate `mana` and obsolete `inventar` URL entries - web/app.d.ts: move __BUILD_HASH__/__BUILD_TIME__ ambient declarations into declare global so they survive module-scoping - web: remove dead supabase template (routes/api/example, lib/server/middleware) — locals.session no longer exists post auth migration - habits/queries: drop stale Record<string,string> cast on LocalHabit (legacy emoji field) - shared-stores/toggle-field: cast to Dexie UpdateSpec instead of Partial<T> for newer dexie types Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
3ffbf37ee7
commit
fc743a494b
6 changed files with 10 additions and 69 deletions
6
apps/mana/apps/web/src/app.d.ts
vendored
6
apps/mana/apps/web/src/app.d.ts
vendored
|
|
@ -1,6 +1,3 @@
|
|||
declare const __BUILD_HASH__: string;
|
||||
declare const __BUILD_TIME__: string;
|
||||
|
||||
/**
|
||||
* App type declarations for Mana web app
|
||||
*
|
||||
|
|
@ -8,6 +5,9 @@ declare const __BUILD_TIME__: string;
|
|||
* No Supabase is needed - all data comes from mana-auth APIs.
|
||||
*/
|
||||
declare global {
|
||||
const __BUILD_HASH__: string;
|
||||
const __BUILD_TIME__: string;
|
||||
|
||||
namespace App {
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
||||
interface Locals {}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,10 @@ export function toHabit(local: LocalHabit): Habit {
|
|||
return {
|
||||
id: local.id,
|
||||
title: local.title,
|
||||
icon: local.icon ?? EMOJI_TO_ICON_MAP[(local as Record<string, string>).emoji] ?? 'star',
|
||||
icon:
|
||||
local.icon ??
|
||||
EMOJI_TO_ICON_MAP[(local as unknown as { emoji?: string }).emoji ?? ''] ??
|
||||
'star',
|
||||
color: local.color,
|
||||
targetPerDay: local.targetPerDay,
|
||||
defaultDuration: local.defaultDuration ?? null,
|
||||
|
|
|
|||
|
|
@ -1,31 +0,0 @@
|
|||
import { MIDDLEWARE_URL } from '$env/static/private';
|
||||
|
||||
/**
|
||||
* Server-side only middleware client
|
||||
* The middleware URL is kept private and not exposed to the browser
|
||||
*/
|
||||
export async function callMiddleware(
|
||||
endpoint: string,
|
||||
options: {
|
||||
method?: string;
|
||||
body?: any;
|
||||
headers?: Record<string, string>;
|
||||
} = {}
|
||||
) {
|
||||
const url = `${MIDDLEWARE_URL}${endpoint}`;
|
||||
|
||||
const response = await fetch(url, {
|
||||
method: options.method || 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
...options.headers,
|
||||
},
|
||||
body: options.body ? JSON.stringify(options.body) : undefined,
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`Middleware error: ${response.statusText}`);
|
||||
}
|
||||
|
||||
return response.json();
|
||||
}
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
import { json, error } from '@sveltejs/kit';
|
||||
import { callMiddleware } from '$lib/server/middleware';
|
||||
import type { RequestHandler } from './$types';
|
||||
|
||||
/**
|
||||
* Example API route that proxies to the middleware
|
||||
* The middleware URL stays hidden on the server
|
||||
*/
|
||||
export const GET: RequestHandler = async ({ locals: { session } }) => {
|
||||
if (!session) {
|
||||
throw error(401, 'Unauthorized');
|
||||
}
|
||||
|
||||
try {
|
||||
// Call middleware from server-side only
|
||||
// The middleware URL is never exposed to the client
|
||||
const data = await callMiddleware('/api/some-endpoint', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Authorization: `Bearer ${session.access_token}`,
|
||||
},
|
||||
});
|
||||
|
||||
return json(data);
|
||||
} catch (err) {
|
||||
console.error('Middleware call failed:', err);
|
||||
throw error(500, 'Failed to fetch data from middleware');
|
||||
}
|
||||
};
|
||||
|
|
@ -750,7 +750,6 @@ export const APP_SLIDER_LABELS = {
|
|||
export const APP_URLS: Record<AppIconId, { dev: string; prod: string }> = {
|
||||
// ─── Unified App (internal paths) ─────────────────────────
|
||||
mana: { dev: 'http://localhost:5173', prod: 'https://mana.how' },
|
||||
mana: { dev: 'http://localhost:5173', prod: 'https://mana.how' },
|
||||
todo: { dev: 'http://localhost:5173/todo', prod: 'https://mana.how/todo' },
|
||||
calendar: { dev: 'http://localhost:5173/calendar', prod: 'https://mana.how/calendar' },
|
||||
contacts: { dev: 'http://localhost:5173/contacts', prod: 'https://mana.how/contacts' },
|
||||
|
|
@ -762,8 +761,7 @@ export const APP_URLS: Record<AppIconId, { dev: string; prod: string }> = {
|
|||
music: { dev: 'http://localhost:5173/music', prod: 'https://mana.how/music' },
|
||||
storage: { dev: 'http://localhost:5173/storage', prod: 'https://mana.how/storage' },
|
||||
presi: { dev: 'http://localhost:5173/presi', prod: 'https://mana.how/presi' },
|
||||
inventar: { dev: 'http://localhost:5173/inventar', prod: 'https://mana.how/inventar' },
|
||||
inventory: { dev: 'http://localhost:5173/inventar', prod: 'https://mana.how/inventar' },
|
||||
inventory: { dev: 'http://localhost:5173/inventory', prod: 'https://mana.how/inventory' },
|
||||
photos: { dev: 'http://localhost:5173/photos', prod: 'https://mana.how/photos' },
|
||||
skilltree: { dev: 'http://localhost:5173/skilltree', prod: 'https://mana.how/skilltree' },
|
||||
citycorners: { dev: 'http://localhost:5173/citycorners', prod: 'https://mana.how/citycorners' },
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* ```
|
||||
*/
|
||||
|
||||
import type { Table } from 'dexie';
|
||||
import type { Table, UpdateSpec } from 'dexie';
|
||||
|
||||
/**
|
||||
* Toggle a boolean field on a Dexie record.
|
||||
|
|
@ -36,7 +36,7 @@ export async function toggleField<T>(
|
|||
await table.update(id, {
|
||||
[field]: newValue,
|
||||
updatedAt: new Date().toISOString(),
|
||||
} as Partial<T>);
|
||||
} as unknown as UpdateSpec<T>);
|
||||
|
||||
return newValue;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue