diff --git a/.changeset/thick-lizards-learn.md b/.changeset/thick-lizards-learn.md new file mode 100644 index 00000000..ee4c7cdf --- /dev/null +++ b/.changeset/thick-lizards-learn.md @@ -0,0 +1,7 @@ +--- +"@metalizzsas/nuster-turbine-machines": patch +"@metalizzsas/nuster-typings": patch +"@metalizzsas/nuster-turbine": patch +--- + +Migrated from id to \_id on mongoose documents diff --git a/.changeset/unlucky-cows-battle.md b/.changeset/unlucky-cows-battle.md new file mode 100644 index 00000000..53d1ba4d --- /dev/null +++ b/.changeset/unlucky-cows-battle.md @@ -0,0 +1,6 @@ +--- +"@metalizzsas/nuster-desktop": patch +"@metalizzsas/nuster-turbine": patch +--- + +Made profiles work again diff --git a/libs/turbine-machines/data/metalfog/m/1/specs.json b/libs/turbine-machines/data/metalfog/m/1/specs.json index accbcaca..56e725c1 100644 --- a/libs/turbine-machines/data/metalfog/m/1/specs.json +++ b/libs/turbine-machines/data/metalfog/m/1/specs.json @@ -686,7 +686,7 @@ "profilePremades": [ { "skeleton": "default", - "id": "premade_usl", + "_id": "premade_usl", "name": "usl", "isPremade": true, "isRemovable": false, @@ -721,7 +721,7 @@ }, { "skeleton": "default", - "id": "premade_usl-retake", + "_id": "premade_usl-retake", "name": "usl-retake", "isPremade": true, "isRemovable": false, @@ -756,7 +756,7 @@ }, { "skeleton": "default", - "id": "premade_usl-activation-porous", + "_id": "premade_usl-activation-porous", "name": "usl-activation-porous", "isPremade": true, "isRemovable": false, @@ -4999,7 +4999,7 @@ "content": [ { "skeleton": "default", - "id": "premade_cem", + "_id": "premade_cem", "name": "cem", "isPremade": true, "isRemovable": false, @@ -5034,7 +5034,7 @@ }, { "skeleton": "default", - "id": "premade_cem-retake", + "_id": "premade_cem-retake", "name": "cem-retake", "isPremade": true, "isRemovable": false, @@ -5096,7 +5096,7 @@ "content": [ { "skeleton": "default", - "id": "premade_llc", + "_id": "premade_llc", "name": "llc", "isPremade": true, "isRemovable": false, diff --git a/libs/turbine-machines/data/smoothit/m/1/specs.json b/libs/turbine-machines/data/smoothit/m/1/specs.json index b9ac7ab2..da1a1bdc 100644 --- a/libs/turbine-machines/data/smoothit/m/1/specs.json +++ b/libs/turbine-machines/data/smoothit/m/1/specs.json @@ -424,7 +424,7 @@ "profilePremades": [ { "skeleton": "default", - "id": "premade_fdm", + "_id": "premade_fdm", "name": "fdm", "isPremade": true, "isRemovable": false, @@ -454,7 +454,7 @@ }, { "skeleton": "default", - "id": "premade_sls", + "_id": "premade_sls", "name": "sls", "isPremade": true, "isRemovable": false, @@ -484,7 +484,7 @@ }, { "skeleton": "default", - "id": "premade_sla", + "_id": "premade_sla", "name": "sla", "isPremade": true, "isRemovable": false, diff --git a/libs/turbine-machines/data/smoothit/m/2/specs.json b/libs/turbine-machines/data/smoothit/m/2/specs.json index 5b9b712e..ce6643b0 100644 --- a/libs/turbine-machines/data/smoothit/m/2/specs.json +++ b/libs/turbine-machines/data/smoothit/m/2/specs.json @@ -419,7 +419,7 @@ "profilePremades": [ { "skeleton": "default", - "id": "premade_fdm", + "_id": "premade_fdm", "name": "fdm", "isPremade": true, "isOverwritable": false, @@ -449,7 +449,7 @@ }, { "skeleton": "default", - "id": "premade_sls", + "_id": "premade_sls", "name": "sls", "isPremade": true, "isOverwritable": false, @@ -479,7 +479,7 @@ }, { "skeleton": "default", - "id": "premade_sla", + "_id": "premade_sla", "name": "sla", "isPremade": true, "isOverwritable": false, diff --git a/libs/turbine-machines/data/uscleaner/m/1/specs.json b/libs/turbine-machines/data/uscleaner/m/1/specs.json index ef772e5e..9e6afdef 100644 --- a/libs/turbine-machines/data/uscleaner/m/1/specs.json +++ b/libs/turbine-machines/data/uscleaner/m/1/specs.json @@ -132,7 +132,7 @@ "profilePremades": [ { "skeleton": "default", - "id": "premade_5min", + "_id": "premade_5min", "name": "5min30deg", "isPremade": true, "isRemovable": false, @@ -435,7 +435,7 @@ "content": [ { "skeleton": "default", - "id": "premade_10min30deg", + "_id": "premade_10min30deg", "name": "10min30deg", "isRemovable": false, "isOverwritable": false, diff --git a/libs/typings/src/hydrated/profile/index.ts b/libs/typings/src/hydrated/profile/index.ts index 9f1f99e3..94acbb9f 100644 --- a/libs/typings/src/hydrated/profile/index.ts +++ b/libs/typings/src/hydrated/profile/index.ts @@ -1,5 +1,5 @@ import { IProfileConfig, ProfileSkeletonFields } from "../../spec/profile"; -export type IProfileHydrated = Omit & { id?: string, modificationDate: number, values: ProfileSkeletonFields[] }; +export type IProfileHydrated = Omit & { modificationDate: number, values: ProfileSkeletonFields[] }; -export type IProfileStored = Omit & { id?: string, modificationDate: number }; \ No newline at end of file +export type IProfileStored = IProfileConfig & { modificationDate: number }; \ No newline at end of file diff --git a/libs/typings/src/spec/profile/index.ts b/libs/typings/src/spec/profile/index.ts index 4d6f6eb0..d776b7d8 100644 --- a/libs/typings/src/spec/profile/index.ts +++ b/libs/typings/src/spec/profile/index.ts @@ -5,7 +5,7 @@ export interface IProfileConfig { name: string; /** Premade profile have id */ - id?: string; + _id?: string; /** Name of the referencing skeleton profile */ skeleton: string; diff --git a/packages/desktop/src/lib/components/cycle/cyclepreparation.svelte b/packages/desktop/src/lib/components/cycle/cyclepreparation.svelte index d972a51d..54761837 100644 --- a/packages/desktop/src/lib/components/cycle/cyclepreparation.svelte +++ b/packages/desktop/src/lib/components/cycle/cyclepreparation.svelte @@ -10,8 +10,8 @@ import Navcontainertitle from '../navigation/navcontainertitle.svelte'; import { layoutSimplified } from '$lib/utils/stores/settings'; - const prepareCycle = (cycleType: string, profileID: string) => { - void fetch(`//${$Linker}/api/v1/cycle/${cycleType}/${profileID}`, { + const prepareCycle = (cycleType: string, profileID: string | undefined) => { + void fetch(`//${$Linker}/api/v1/cycle/${cycleType}/${profileID != undefined ? profileID : ''}`, { method: 'POST', headers: { 'Content-Type': 'application/json', @@ -73,7 +73,7 @@ {#each $machineData.profiles.filter((p) => p.skeleton == ct.name && p.isPremade != true) as p}
prepareCycle(ct.name, p.id)} + on:click={() => prepareCycle(ct.name, p._id)} >
k.id == selectedProfile); + $: $profile = profiles.find((k) => k._id == selectedProfile); $: if ($machineData.cycle !== undefined) void goto('/app/cycle'); $: if (saveProfileNameInvalid == true) { setTimeout(() => (saveProfileNameInvalid = false), 5000); @@ -51,7 +51,7 @@ const defaultProfile: IProfileHydrated = { skeleton: "default", - id: "skeleton", + _id: "skeleton", name: "—", isRemovable: false, @@ -66,11 +66,11 @@ const saveProfile = async (name?: string) => { if ($profile !== undefined) { - const newp = $profile.id == 'skeleton'; + const newp = $profile._id == 'skeleton'; if (name) $profile.name = name; - if (newp) $profile.id = 'created'; + if (newp) $profile._id = 'created'; await fetch('//' + $Linker + '/api/v1/profiles' + (newp ? '/create' : ''), { method: newp ? 'PUT' : 'POST', @@ -85,7 +85,7 @@ const deleteProfile = async () => { if ($profile !== undefined) { - await fetch(`//${$Linker}/api/v1/profiles/${$profile.id || ''}`, { + await fetch(`//${$Linker}/api/v1/profiles/${$profile._id || ''}`, { method: 'DELETE', }); @@ -95,11 +95,11 @@ const quickStart = async () => { if ($profile !== undefined) { - const QSProfile = $profile.id == 'skeleton'; + const QSProfile = $profile._id == 'skeleton'; if (QSProfile) $profile.name = 'Quickstart'; - const url = `//${$Linker}/api/v1/cycle/default/${(QSProfile ? '' : ($profile.id || ''))}`; + const url = `//${$Linker}/api/v1/cycle/default/${(QSProfile ? '' : ($profile._id || ''))}`; const body = QSProfile ? JSON.stringify(profile) : ''; const startRequest = await fetch(url, { @@ -201,7 +201,7 @@ bind:value={selectedProfile} > {#each profiles.sort((a, b) => (a.name < b.name ? 1 : -1)) as profileListElement} -