Milestone 3: launch (20261008.05)
Backup and restore: restore from Settings (any backup in the folder, or an
uploaded file) or from the command line with scripts/restore.sh. Each restore
checks the file first, saves a copy of the current data so it can be undone,
and keeps the person restoring signed in. Backups are now single
self-contained files. Drilled end to end: last night's backup brings
everything back exactly, including onto an empty new machine.
Speed: a phone's first load is 147 KB compressed (target 150). The ideas box,
account menu and sign-in screens load on demand, a small built-in toast
replaces sonner, the Inter font is trimmed to the characters used, and files
and API answers are served compressed. Every screen's data comes back in
under 100 ms with 50,000 transactions (server/bench).
Accessibility: no WCAG 2.2 AA issues on any screen in either theme. Darker
status text colors, 44 px touch targets on phones, reduced motion honoured,
and focus returns after dialogs close.
Also: an in-app guide ("How Spendlight works"), OFX/QFX/QBO import, and tags
on individual parts of a split purchase.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -4,7 +4,7 @@ import { logChange } from '../audit';
|
||||
import { requireUser, requireWrite } from '../auth/guards';
|
||||
import { rememberRule } from '../categorize/suggest';
|
||||
import type { AppContext } from '../context';
|
||||
import { budgets, categories, categoryGroups, rules, splits, subscriptions, tags, transactions, transactionTags, type CategoryRow } from '../db/schema';
|
||||
import { budgets, categories, categoryGroups, rules, splits, splitTags, subscriptions, tags, transactions, transactionTags, type CategoryRow } from '../db/schema';
|
||||
import { fail, nowIso, type Env } from '../http';
|
||||
import { CategoryGroupSchema, CategorySchema, IdParam, jsonBody, jsonResponse, PaletteSchema, validationHook } from '../schemas';
|
||||
import { listCategoryGroups } from '../transactions/dto';
|
||||
@@ -249,13 +249,14 @@ export function categoryRoutes(ctx: AppContext) {
|
||||
}),
|
||||
(c) => {
|
||||
requireUser(c);
|
||||
const rows = ctx.db
|
||||
.select({ id: tags.id, name: tags.name, count: count(transactionTags.transactionId) })
|
||||
.from(tags)
|
||||
.leftJoin(transactionTags, eq(transactionTags.tagId, tags.id))
|
||||
.groupBy(tags.id)
|
||||
.orderBy(desc(count(transactionTags.transactionId)), tags.name)
|
||||
.all();
|
||||
// Uses: transactions tagged, plus purchases with a tagged part.
|
||||
const rows = ctx.sqlite
|
||||
.prepare(
|
||||
`SELECT t.id, t.name, (SELECT count(*) FROM txn_tag tt WHERE tt.tag_id = t.id)
|
||||
+ (SELECT count(DISTINCT s.transaction_id) FROM split_tag st JOIN split s ON s.id = st.split_id WHERE st.tag_id = t.id) AS count
|
||||
FROM tag t ORDER BY count DESC, t.name`,
|
||||
)
|
||||
.all() as { id: number; name: string; count: number }[];
|
||||
return c.json(rows, 200);
|
||||
},
|
||||
);
|
||||
@@ -281,6 +282,9 @@ export function categoryRoutes(ctx: AppContext) {
|
||||
for (const link of ctx.db.select().from(transactionTags).where(eq(transactionTags.tagId, id)).all()) {
|
||||
ctx.db.insert(transactionTags).values({ transactionId: link.transactionId, tagId: other.id }).onConflictDoNothing().run();
|
||||
}
|
||||
for (const link of ctx.db.select().from(splitTags).where(eq(splitTags.tagId, id)).all()) {
|
||||
ctx.db.insert(splitTags).values({ splitId: link.splitId, tagId: other.id }).onConflictDoNothing().run();
|
||||
}
|
||||
ctx.db.delete(tags).where(eq(tags.id, id)).run();
|
||||
result = { id: other.id, name: other.name };
|
||||
} else ctx.db.update(tags).set({ name }).where(eq(tags.id, id)).run();
|
||||
|
||||
Reference in New Issue
Block a user