Compare commits
2
Commits
fc541f024d
...
8205fee420
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8205fee420 | ||
|
|
4869756957 |
No files matched your search
+1
-5
@@ -657,7 +657,6 @@ const normalizeBird = (row: BirdRow) => ({
|
|||||||
publicProfileEnabled: row.public_profile_enabled ?? false,
|
publicProfileEnabled: row.public_profile_enabled ?? false,
|
||||||
memorializedAt: row.memorialized_at,
|
memorializedAt: row.memorialized_at,
|
||||||
memorializedOn: row.memorialized_on,
|
memorializedOn: row.memorialized_on,
|
||||||
memorialNote: row.memorial_note,
|
|
||||||
notifyOnMemorialDay: row.notify_on_memorial_day,
|
notifyOnMemorialDay: row.notify_on_memorial_day,
|
||||||
createdAt: row.created_at,
|
createdAt: row.created_at,
|
||||||
latestWeightGrams: row.latest_weight_grams ? Number(row.latest_weight_grams) : null,
|
latestWeightGrams: row.latest_weight_grams ? Number(row.latest_weight_grams) : null,
|
||||||
@@ -1712,9 +1711,7 @@ const buildBirdMilestoneReminderCopy = (reminder: BirdMilestoneReminderCandidate
|
|||||||
yearCount > 0
|
yearCount > 0
|
||||||
? `From our flock to yours, holding ${reminder.name}'s memory close on this ${formatOrdinal(yearCount)} memorial day.`
|
? `From our flock to yours, holding ${reminder.name}'s memory close on this ${formatOrdinal(yearCount)} memorial day.`
|
||||||
: `From our flock to yours, holding ${reminder.name}'s memory close today.`,
|
: `From our flock to yours, holding ${reminder.name}'s memory close today.`,
|
||||||
body: reminder.memorial_note
|
body: 'A quiet moment for the feathers, songs, routines, and happy memories that still stay with you.',
|
||||||
? reminder.memorial_note
|
|
||||||
: 'A quiet moment for the feathers, songs, routines, and happy memories that still stay with you.',
|
|
||||||
milestoneLabel: yearCount > 0 ? `${formatOrdinal(yearCount)} Memorial Day` : 'Memorial Day on file',
|
milestoneLabel: yearCount > 0 ? `${formatOrdinal(yearCount)} Memorial Day` : 'Memorial Day on file',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -4015,7 +4012,6 @@ app.post('/api/birds/:birdId/memorialize', requireAuth, requireWriteAccess, requ
|
|||||||
birdId: req.params.birdId,
|
birdId: req.params.birdId,
|
||||||
workspaceId: req.auth!.workspace.id,
|
workspaceId: req.auth!.workspace.id,
|
||||||
memorializedOn: parsed.data.memorializedOn,
|
memorializedOn: parsed.data.memorializedOn,
|
||||||
memorialNote: emptyToNull(parsed.data.memorialNote),
|
|
||||||
notifyOnMemorialDay: parsed.data.notifyOnMemorialDay ?? false,
|
notifyOnMemorialDay: parsed.data.notifyOnMemorialDay ?? false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -235,7 +235,6 @@ export const ensureSchema = async (database: DatabaseClient = db) => {
|
|||||||
public_profile_enabled BOOLEAN NOT NULL DEFAULT FALSE,
|
public_profile_enabled BOOLEAN NOT NULL DEFAULT FALSE,
|
||||||
memorialized_at TIMESTAMPTZ,
|
memorialized_at TIMESTAMPTZ,
|
||||||
memorialized_on DATE,
|
memorialized_on DATE,
|
||||||
memorial_note VARCHAR(1000),
|
|
||||||
notify_on_memorial_day BOOLEAN NOT NULL DEFAULT FALSE,
|
notify_on_memorial_day BOOLEAN NOT NULL DEFAULT FALSE,
|
||||||
created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP
|
created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||||
);
|
);
|
||||||
@@ -265,7 +264,6 @@ export const ensureSchema = async (database: DatabaseClient = db) => {
|
|||||||
ADD COLUMN IF NOT EXISTS public_profile_enabled BOOLEAN NOT NULL DEFAULT FALSE,
|
ADD COLUMN IF NOT EXISTS public_profile_enabled BOOLEAN NOT NULL DEFAULT FALSE,
|
||||||
ADD COLUMN IF NOT EXISTS memorialized_at TIMESTAMPTZ,
|
ADD COLUMN IF NOT EXISTS memorialized_at TIMESTAMPTZ,
|
||||||
ADD COLUMN IF NOT EXISTS memorialized_on DATE,
|
ADD COLUMN IF NOT EXISTS memorialized_on DATE,
|
||||||
ADD COLUMN IF NOT EXISTS memorial_note VARCHAR(1000),
|
|
||||||
ADD COLUMN IF NOT EXISTS notify_on_memorial_day BOOLEAN NOT NULL DEFAULT FALSE;
|
ADD COLUMN IF NOT EXISTS notify_on_memorial_day BOOLEAN NOT NULL DEFAULT FALSE;
|
||||||
|
|
||||||
ALTER TABLE birds
|
ALTER TABLE birds
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export const birdResponse = z.object({
|
|||||||
photoDataUrl: text.describe('Photo URL or legacy data URL. Storage-backed URLs expire; refresh the bird list to obtain a new URL.'),
|
photoDataUrl: text.describe('Photo URL or legacy data URL. Storage-backed URLs expire; refresh the bird list to obtain a new URL.'),
|
||||||
photoObjectKey: text, photoContentType: text, photoUpdatedAt: timestamp.nullable(),
|
photoObjectKey: text, photoContentType: text, photoUpdatedAt: timestamp.nullable(),
|
||||||
notifyOnDob: z.boolean(), notifyOnGotchaDay: z.boolean(), publicProfileCode: text, publicProfileEnabled: z.boolean(),
|
notifyOnDob: z.boolean(), notifyOnGotchaDay: z.boolean(), publicProfileCode: text, publicProfileEnabled: z.boolean(),
|
||||||
memorializedAt: timestamp.nullable(), memorializedOn: date.nullable(), memorialNote: text,
|
memorializedAt: timestamp.nullable(), memorializedOn: date.nullable(),
|
||||||
notifyOnMemorialDay: z.boolean(), createdAt: timestamp,
|
notifyOnMemorialDay: z.boolean(), createdAt: timestamp,
|
||||||
latestWeightGrams: z.number().nullable(), latestRecordedOn: date.nullable(),
|
latestWeightGrams: z.number().nullable(), latestRecordedOn: date.nullable(),
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ const birdSelectFields = `
|
|||||||
birds.public_profile_enabled,
|
birds.public_profile_enabled,
|
||||||
birds.memorialized_at,
|
birds.memorialized_at,
|
||||||
birds.memorialized_on::text,
|
birds.memorialized_on::text,
|
||||||
birds.memorial_note,
|
|
||||||
birds.notify_on_memorial_day,
|
birds.notify_on_memorial_day,
|
||||||
birds.created_at,
|
birds.created_at,
|
||||||
latest.weight_grams AS latest_weight_grams,
|
latest.weight_grams AS latest_weight_grams,
|
||||||
@@ -544,7 +543,7 @@ export const createBird = async ({
|
|||||||
const result = await db.query<BirdRow>(
|
const result = await db.query<BirdRow>(
|
||||||
`INSERT INTO birds (id, workspace_id, name, tag_id, species, motivators, demotivators, favorite_snack, location_label, location_details, vet_clinic_name, vet_clinic_address, vet_account_number, vet_doctor_name, gender, date_of_birth, gotcha_day, chart_color, photo_data_url, photo_object_key, photo_content_type, photo_updated_at, notify_on_dob, notify_on_gotcha_day, public_profile_code, public_profile_enabled)
|
`INSERT INTO birds (id, workspace_id, name, tag_id, species, motivators, demotivators, favorite_snack, location_label, location_details, vet_clinic_name, vet_clinic_address, vet_account_number, vet_doctor_name, gender, date_of_birth, gotcha_day, chart_color, photo_data_url, photo_object_key, photo_content_type, photo_updated_at, notify_on_dob, notify_on_gotcha_day, public_profile_code, public_profile_enabled)
|
||||||
VALUES (COALESCE($1::uuid, gen_random_uuid()), $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26)
|
VALUES (COALESCE($1::uuid, gen_random_uuid()), $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26)
|
||||||
RETURNING id, workspace_id, name, tag_id, species, motivators, demotivators, favorite_snack, location_label, location_details, vet_clinic_name, vet_clinic_address, vet_account_number, vet_doctor_name, gender, date_of_birth::text, gotcha_day::text, chart_color, photo_data_url, photo_object_key, photo_content_type, photo_updated_at, notify_on_dob, notify_on_gotcha_day, public_profile_code, public_profile_enabled, memorialized_at, memorialized_on::text, memorial_note, notify_on_memorial_day, created_at, NULL::text AS latest_weight_grams, NULL::text AS latest_recorded_on`,
|
RETURNING id, workspace_id, name, tag_id, species, motivators, demotivators, favorite_snack, location_label, location_details, vet_clinic_name, vet_clinic_address, vet_account_number, vet_doctor_name, gender, date_of_birth::text, gotcha_day::text, chart_color, photo_data_url, photo_object_key, photo_content_type, photo_updated_at, notify_on_dob, notify_on_gotcha_day, public_profile_code, public_profile_enabled, memorialized_at, memorialized_on::text, notify_on_memorial_day, created_at, NULL::text AS latest_weight_grams, NULL::text AS latest_recorded_on`,
|
||||||
[
|
[
|
||||||
birdId ?? null,
|
birdId ?? null,
|
||||||
workspaceId,
|
workspaceId,
|
||||||
@@ -662,7 +661,7 @@ export const updateBird = async ({
|
|||||||
WHERE id = $1
|
WHERE id = $1
|
||||||
AND workspace_id = $26
|
AND workspace_id = $26
|
||||||
AND memorialized_at IS NULL
|
AND memorialized_at IS NULL
|
||||||
RETURNING id, workspace_id, name, tag_id, species, motivators, demotivators, favorite_snack, location_label, location_details, vet_clinic_name, vet_clinic_address, vet_account_number, vet_doctor_name, gender, date_of_birth::text, gotcha_day::text, chart_color, photo_data_url, photo_object_key, photo_content_type, photo_updated_at, notify_on_dob, notify_on_gotcha_day, public_profile_code, public_profile_enabled, memorialized_at, memorialized_on::text, memorial_note, notify_on_memorial_day, created_at,
|
RETURNING id, workspace_id, name, tag_id, species, motivators, demotivators, favorite_snack, location_label, location_details, vet_clinic_name, vet_clinic_address, vet_account_number, vet_doctor_name, gender, date_of_birth::text, gotcha_day::text, chart_color, photo_data_url, photo_object_key, photo_content_type, photo_updated_at, notify_on_dob, notify_on_gotcha_day, public_profile_code, public_profile_enabled, memorialized_at, memorialized_on::text, notify_on_memorial_day, created_at,
|
||||||
(
|
(
|
||||||
SELECT weight_grams::text
|
SELECT weight_grams::text
|
||||||
FROM weight_records
|
FROM weight_records
|
||||||
@@ -714,25 +713,22 @@ export const memorializeBird = async ({
|
|||||||
birdId,
|
birdId,
|
||||||
workspaceId,
|
workspaceId,
|
||||||
memorializedOn,
|
memorializedOn,
|
||||||
memorialNote,
|
|
||||||
notifyOnMemorialDay,
|
notifyOnMemorialDay,
|
||||||
}: {
|
}: {
|
||||||
birdId: string;
|
birdId: string;
|
||||||
workspaceId: number;
|
workspaceId: number;
|
||||||
memorializedOn: string;
|
memorializedOn: string;
|
||||||
memorialNote: string | null;
|
|
||||||
notifyOnMemorialDay: boolean;
|
notifyOnMemorialDay: boolean;
|
||||||
}) => {
|
}) => {
|
||||||
const result = await db.query<BirdRow>(
|
const result = await db.query<BirdRow>(
|
||||||
`UPDATE birds
|
`UPDATE birds
|
||||||
SET memorialized_at = CURRENT_TIMESTAMP,
|
SET memorialized_at = CURRENT_TIMESTAMP,
|
||||||
memorialized_on = $3,
|
memorialized_on = $3,
|
||||||
memorial_note = $4,
|
notify_on_memorial_day = $4
|
||||||
notify_on_memorial_day = $5
|
|
||||||
WHERE id = $1
|
WHERE id = $1
|
||||||
AND workspace_id = $2
|
AND workspace_id = $2
|
||||||
AND memorialized_at IS NULL
|
AND memorialized_at IS NULL
|
||||||
RETURNING id, workspace_id, name, tag_id, species, motivators, demotivators, favorite_snack, location_label, location_details, vet_clinic_name, vet_clinic_address, vet_account_number, vet_doctor_name, gender, date_of_birth::text, gotcha_day::text, chart_color, photo_data_url, photo_object_key, photo_content_type, photo_updated_at, notify_on_dob, notify_on_gotcha_day, public_profile_code, public_profile_enabled, memorialized_at, memorialized_on::text, memorial_note, notify_on_memorial_day, created_at,
|
RETURNING id, workspace_id, name, tag_id, species, motivators, demotivators, favorite_snack, location_label, location_details, vet_clinic_name, vet_clinic_address, vet_account_number, vet_doctor_name, gender, date_of_birth::text, gotcha_day::text, chart_color, photo_data_url, photo_object_key, photo_content_type, photo_updated_at, notify_on_dob, notify_on_gotcha_day, public_profile_code, public_profile_enabled, memorialized_at, memorialized_on::text, notify_on_memorial_day, created_at,
|
||||||
(
|
(
|
||||||
SELECT weight_grams::text
|
SELECT weight_grams::text
|
||||||
FROM weight_records
|
FROM weight_records
|
||||||
@@ -747,7 +743,7 @@ export const memorializeBird = async ({
|
|||||||
ORDER BY recorded_on DESC
|
ORDER BY recorded_on DESC
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
) AS latest_recorded_on`,
|
) AS latest_recorded_on`,
|
||||||
[birdId, workspaceId, memorializedOn, memorialNote, notifyOnMemorialDay],
|
[birdId, workspaceId, memorializedOn, notifyOnMemorialDay],
|
||||||
);
|
);
|
||||||
|
|
||||||
return result.rows[0] ?? null;
|
return result.rows[0] ?? null;
|
||||||
@@ -768,7 +764,7 @@ export const updateMemorialReminderPreference = async ({
|
|||||||
WHERE id = $1
|
WHERE id = $1
|
||||||
AND workspace_id = $2
|
AND workspace_id = $2
|
||||||
AND memorialized_at IS NOT NULL
|
AND memorialized_at IS NOT NULL
|
||||||
RETURNING id, workspace_id, name, tag_id, species, motivators, demotivators, favorite_snack, location_label, location_details, vet_clinic_name, vet_clinic_address, vet_account_number, vet_doctor_name, gender, date_of_birth::text, gotcha_day::text, chart_color, photo_data_url, photo_object_key, photo_content_type, photo_updated_at, notify_on_dob, notify_on_gotcha_day, public_profile_code, public_profile_enabled, memorialized_at, memorialized_on::text, memorial_note, notify_on_memorial_day, created_at,
|
RETURNING id, workspace_id, name, tag_id, species, motivators, demotivators, favorite_snack, location_label, location_details, vet_clinic_name, vet_clinic_address, vet_account_number, vet_doctor_name, gender, date_of_birth::text, gotcha_day::text, chart_color, photo_data_url, photo_object_key, photo_content_type, photo_updated_at, notify_on_dob, notify_on_gotcha_day, public_profile_code, public_profile_enabled, memorialized_at, memorialized_on::text, notify_on_memorial_day, created_at,
|
||||||
(
|
(
|
||||||
SELECT weight_grams::text
|
SELECT weight_grams::text
|
||||||
FROM weight_records
|
FROM weight_records
|
||||||
@@ -796,7 +792,7 @@ export const transferBirdToWorkspace = async (birdId: string, sourceWorkspaceId:
|
|||||||
WHERE id = $1
|
WHERE id = $1
|
||||||
AND workspace_id = $2
|
AND workspace_id = $2
|
||||||
AND memorialized_at IS NULL
|
AND memorialized_at IS NULL
|
||||||
RETURNING id, workspace_id, name, tag_id, species, motivators, demotivators, favorite_snack, location_label, location_details, vet_clinic_name, vet_clinic_address, vet_account_number, vet_doctor_name, gender, date_of_birth::text, gotcha_day::text, chart_color, photo_data_url, photo_object_key, photo_content_type, photo_updated_at, notify_on_dob, notify_on_gotcha_day, public_profile_code, public_profile_enabled, memorialized_at, memorialized_on::text, memorial_note, notify_on_memorial_day, created_at,
|
RETURNING id, workspace_id, name, tag_id, species, motivators, demotivators, favorite_snack, location_label, location_details, vet_clinic_name, vet_clinic_address, vet_account_number, vet_doctor_name, gender, date_of_birth::text, gotcha_day::text, chart_color, photo_data_url, photo_object_key, photo_content_type, photo_updated_at, notify_on_dob, notify_on_gotcha_day, public_profile_code, public_profile_enabled, memorialized_at, memorialized_on::text, notify_on_memorial_day, created_at,
|
||||||
(
|
(
|
||||||
SELECT weight_grams::text
|
SELECT weight_grams::text
|
||||||
FROM weight_records
|
FROM weight_records
|
||||||
|
|||||||
@@ -129,7 +129,6 @@ export const birdSchema = z.object({
|
|||||||
|
|
||||||
export const memorializeBirdSchema = z.object({
|
export const memorializeBirdSchema = z.object({
|
||||||
memorializedOn: dateStringSchema,
|
memorializedOn: dateStringSchema,
|
||||||
memorialNote: z.string().trim().max(1000).optional().or(z.literal('')),
|
|
||||||
notifyOnMemorialDay: z.boolean().optional(),
|
notifyOnMemorialDay: z.boolean().optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -121,7 +121,6 @@ export type BirdRow = {
|
|||||||
public_profile_enabled: boolean;
|
public_profile_enabled: boolean;
|
||||||
memorialized_at: string | null;
|
memorialized_at: string | null;
|
||||||
memorialized_on: string | null;
|
memorialized_on: string | null;
|
||||||
memorial_note: string | null;
|
|
||||||
notify_on_memorial_day: boolean;
|
notify_on_memorial_day: boolean;
|
||||||
created_at: string;
|
created_at: string;
|
||||||
latest_weight_grams: string | null;
|
latest_weight_grams: string | null;
|
||||||
|
|||||||
@@ -65,7 +65,6 @@ type Bird = {
|
|||||||
publicProfileEnabled: boolean;
|
publicProfileEnabled: boolean;
|
||||||
memorializedAt: string | null;
|
memorializedAt: string | null;
|
||||||
memorializedOn: string | null;
|
memorializedOn: string | null;
|
||||||
memorialNote: string | null;
|
|
||||||
notifyOnMemorialDay: boolean;
|
notifyOnMemorialDay: boolean;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
latestWeightGrams: number | null;
|
latestWeightGrams: number | null;
|
||||||
@@ -335,7 +334,6 @@ type PublicBirdProfile = {
|
|||||||
|
|
||||||
type MemorializeBirdFormState = {
|
type MemorializeBirdFormState = {
|
||||||
memorializedOn: string;
|
memorializedOn: string;
|
||||||
memorialNote: string;
|
|
||||||
notifyOnMemorialDay: boolean;
|
notifyOnMemorialDay: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -856,7 +854,6 @@ const emptyVeterinaryInfoForm: VeterinaryInfoFormState = {
|
|||||||
|
|
||||||
const emptyMemorializeBirdForm = (): MemorializeBirdFormState => ({
|
const emptyMemorializeBirdForm = (): MemorializeBirdFormState => ({
|
||||||
memorializedOn: new Date().toISOString().slice(0, 10),
|
memorializedOn: new Date().toISOString().slice(0, 10),
|
||||||
memorialNote: '',
|
|
||||||
notifyOnMemorialDay: false,
|
notifyOnMemorialDay: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -6996,14 +6993,6 @@ function App() {
|
|||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
<label className="wide-field">
|
|
||||||
Memorial note
|
|
||||||
<textarea
|
|
||||||
rows={3}
|
|
||||||
value={memorializeBirdForm.memorialNote}
|
|
||||||
onChange={(event) => setMemorializeBirdForm({ ...memorializeBirdForm, memorialNote: event.target.value })}
|
|
||||||
/>
|
|
||||||
</label>
|
|
||||||
<div className="button-row care-form-actions">
|
<div className="button-row care-form-actions">
|
||||||
<button className="danger-button" type="submit" disabled={memorializingBird || activeMembership?.role !== 'owner'}>
|
<button className="danger-button" type="submit" disabled={memorializingBird || activeMembership?.role !== 'owner'}>
|
||||||
{memorializingBird ? 'Memorializing...' : `Memorialize ${selectedBird.name}`}
|
{memorializingBird ? 'Memorializing...' : `Memorialize ${selectedBird.name}`}
|
||||||
|
|||||||
Reference in new issue
Block a user