@7365admin1/layer-common 4.97.1-staging.748 → 4.97.1-staging.749
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -101,6 +101,7 @@
|
|
|
101
101
|
</v-card>
|
|
102
102
|
</template>
|
|
103
103
|
<script setup lang="ts">
|
|
104
|
+
import { replacementHolderId } from "../utils/card-replacement";
|
|
104
105
|
const props = defineProps({
|
|
105
106
|
card: {
|
|
106
107
|
type: Object as PropType<Record<string, any>>,
|
|
@@ -166,14 +167,13 @@ async function submit() {
|
|
|
166
167
|
loading.value = true;
|
|
167
168
|
try {
|
|
168
169
|
const { replaceCard } = useCard();
|
|
169
|
-
|
|
170
|
-
// @TODO: userId should be the ID of the unit owner, not the current user
|
|
170
|
+
// The new card goes to whoever held the old one, not the signed-in admin (DV-2276).
|
|
171
171
|
await replaceCard({
|
|
172
172
|
cardId: props.card._id,
|
|
173
173
|
issuedCardId: form.value.replacementCardId,
|
|
174
174
|
unitId: props.unit._id,
|
|
175
175
|
remarks: form.value.remarks.trim(),
|
|
176
|
-
userId:
|
|
176
|
+
userId: replacementHolderId(props.card),
|
|
177
177
|
});
|
|
178
178
|
emit("success");
|
|
179
179
|
} catch (error: any) {
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@7365admin1/layer-common",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "4.97.1-staging.
|
|
5
|
+
"version": "4.97.1-staging.749",
|
|
6
6
|
"author": "7365admin1",
|
|
7
7
|
"main": "./nuxt.config.ts",
|
|
8
8
|
"//files": "What a consumer extending this layer actually loads. Without this npm ships the whole working tree - the changesets, the CI workflows, the render harness in tools/ and any scratch directory that happened to exist at publish time. Nuxt resolves a layer by directory, so every runtime directory below has to stay listed; adding a new top-level runtime directory means adding it here too.",
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The holder id Replace Card sends with `card-replacement` (DV-2276).
|
|
3
|
+
*
|
|
4
|
+
* It used to send the signed-in admin, so the new card was assigned to them.
|
|
5
|
+
* The replacement belongs to whoever held the old card. Core now reads the
|
|
6
|
+
* holder from the old card itself and ignores this field; it is still sent,
|
|
7
|
+
* as the old card's holder, so a core without that fix also gets it right.
|
|
8
|
+
*/
|
|
9
|
+
export function replacementHolderId(card: Record<string, any> | null | undefined): string {
|
|
10
|
+
const id = card?.userId;
|
|
11
|
+
return id ? String(id) : "";
|
|
12
|
+
}
|