add theme patterns
This commit is contained in:
@@ -146,6 +146,18 @@ async function ensureUsers(ids: Record<string, string>): Promise<void> {
|
||||
usersCol.fields.push({ name: 'color', type: 'text', required: false });
|
||||
changed = true;
|
||||
}
|
||||
if (!has('pattern')) {
|
||||
usersCol.fields.push({ name: 'pattern', type: 'text', required: false });
|
||||
changed = true;
|
||||
}
|
||||
if (!has('themeSize')) {
|
||||
usersCol.fields.push({ name: 'themeSize', type: 'text', required: false });
|
||||
changed = true;
|
||||
}
|
||||
if (!has('themeOpacity')) {
|
||||
usersCol.fields.push({ name: 'themeOpacity', type: 'text', required: false });
|
||||
changed = true;
|
||||
}
|
||||
if (!has('passwordResetToken')) {
|
||||
usersCol.fields.push({ name: 'passwordResetToken', type: 'text', required: false });
|
||||
changed = true;
|
||||
|
||||
@@ -69,7 +69,15 @@ export async function patchFam(pb: any, famId: string, body: Record<string, unkn
|
||||
|
||||
export async function getProfile(pb: any, famId: string, userId: string) {
|
||||
const rec = await pb.collection('users').getOne(userId);
|
||||
return { id: rec.id, name: rec.name || '', color: rec.color || '#6366f1', email: rec.email || '' };
|
||||
return {
|
||||
id: rec.id,
|
||||
name: rec.name || '',
|
||||
color: rec.color || '#6366f1',
|
||||
pattern: rec.pattern || '',
|
||||
themeSize: rec.themeSize || '',
|
||||
themeOpacity: rec.themeOpacity || '',
|
||||
email: rec.email || ''
|
||||
};
|
||||
}
|
||||
|
||||
export async function updateProfile(
|
||||
@@ -81,9 +89,20 @@ export async function updateProfile(
|
||||
const patch: Record<string, unknown> = {};
|
||||
if (data.name) patch.name = data.name;
|
||||
if (data.color) patch.color = data.color;
|
||||
if (data.pattern !== undefined) patch.pattern = data.pattern;
|
||||
if (data.themeSize !== undefined) patch.themeSize = data.themeSize;
|
||||
if (data.themeOpacity !== undefined) patch.themeOpacity = data.themeOpacity;
|
||||
if (data.email !== undefined) patch.email = data.email;
|
||||
const rec = await pb.collection('users').update(userId, patch);
|
||||
return { id: rec.id, name: rec.name || '', color: rec.color || '#6366f1', email: rec.email || '' };
|
||||
return {
|
||||
id: rec.id,
|
||||
name: rec.name || '',
|
||||
color: rec.color || '#6366f1',
|
||||
pattern: rec.pattern || '',
|
||||
themeSize: rec.themeSize || '',
|
||||
themeOpacity: rec.themeOpacity || '',
|
||||
email: rec.email || ''
|
||||
};
|
||||
}
|
||||
|
||||
export async function weeklySummary(pb: any, famId: string) {
|
||||
@@ -309,4 +328,4 @@ export async function completeWeek(pb: any, famId: string) {
|
||||
historyRecords,
|
||||
memberCount: members.length
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,4 +5,7 @@ export interface SessionUser {
|
||||
role: 'parent' | 'child';
|
||||
famId: string;
|
||||
color?: string;
|
||||
}
|
||||
pattern?: string;
|
||||
themeSize?: string;
|
||||
themeOpacity?: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user