From 973a1b80d0ec9c37bbcf3df9b1df39d220b5042a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxi=20Quo=C3=9F?= Date: Wed, 22 Jan 2025 13:21:07 +0100 Subject: [PATCH] feat: add device description field --- .../migrations/1737546920_updated_devices.go | 45 +++++++++++++++++++ frontend/src/lib/components/DeviceCard.svelte | 3 ++ frontend/src/lib/components/DeviceForm.svelte | 15 +++++++ frontend/src/lib/i18n/de/index.ts | 2 + frontend/src/lib/i18n/en/index.ts | 2 + frontend/src/lib/i18n/es/index.ts | 2 + frontend/src/lib/i18n/fr/index.ts | 2 + frontend/src/lib/i18n/i18n-svelte.ts | 1 - frontend/src/lib/i18n/i18n-types.ts | 17 +++++++ frontend/src/lib/i18n/i18n-util.async.ts | 2 +- frontend/src/lib/i18n/i18n-util.sync.ts | 3 +- frontend/src/lib/i18n/i18n-util.ts | 2 +- frontend/src/lib/i18n/it/index.ts | 2 + frontend/src/lib/i18n/ja-JP/index.ts | 8 ++++ frontend/src/lib/i18n/ja/index.ts | 2 + frontend/src/lib/i18n/nl/index.ts | 2 + frontend/src/lib/i18n/pt/index.ts | 2 + frontend/src/lib/i18n/zh-TW/index.ts | 4 +- frontend/src/lib/i18n/zh/index.ts | 2 + frontend/src/lib/types/device.ts | 1 + frontend/src/routes/account/+page.svelte | 1 + 21 files changed, 115 insertions(+), 5 deletions(-) create mode 100644 backend/migrations/1737546920_updated_devices.go create mode 100644 frontend/src/lib/i18n/ja-JP/index.ts diff --git a/backend/migrations/1737546920_updated_devices.go b/backend/migrations/1737546920_updated_devices.go new file mode 100644 index 00000000..16ea8eb9 --- /dev/null +++ b/backend/migrations/1737546920_updated_devices.go @@ -0,0 +1,45 @@ +package migrations + +import ( + "github.com/pocketbase/pocketbase/core" + m "github.com/pocketbase/pocketbase/migrations" +) + +func init() { + m.Register(func(app core.App) error { + collection, err := app.FindCollectionByNameOrId("z5lghx2r3tm45n1") + if err != nil { + return err + } + + // add field + if err := collection.Fields.AddMarshaledJSONAt(5, []byte(`{ + "autogeneratePattern": "", + "hidden": false, + "id": "text1843675174", + "max": 0, + "min": 0, + "name": "description", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, + "system": false, + "type": "text" + }`)); err != nil { + return err + } + + return app.Save(collection) + }, func(app core.App) error { + collection, err := app.FindCollectionByNameOrId("z5lghx2r3tm45n1") + if err != nil { + return err + } + + // remove field + collection.Fields.RemoveById("text1843675174") + + return app.Save(collection) + }) +} diff --git a/frontend/src/lib/components/DeviceCard.svelte b/frontend/src/lib/components/DeviceCard.svelte index 1ed5b6d4..fcbecb0c 100644 --- a/frontend/src/lib/components/DeviceCard.svelte +++ b/frontend/src/lib/components/DeviceCard.svelte @@ -157,6 +157,9 @@ {:else}

{device.name}

{/if} + {#if device.description} +

{device.description}

+ {/if}