diff --git a/package.json b/package.json index 7129b28e..5b162992 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "cy:open": "CYPRESS_CACHE_FOLDER='node_modules/.cache/Cypress' yarn cypress open -C cypress/config/cypress.config.ts" }, "dependencies": { - "@anzusystems/common-admin": "1.40.0-alpha19", + "@anzusystems/common-admin": "1.40.0-alpha20", "@mdi/font": "7.3.67", "@vuelidate/core": "^2.0.3", "@vuelidate/validators": "^2.0.4", diff --git a/src/composables/system/currentExtSystem.ts b/src/composables/system/currentExtSystem.ts index 57b93b4e..5d6841d9 100644 --- a/src/composables/system/currentExtSystem.ts +++ b/src/composables/system/currentExtSystem.ts @@ -3,14 +3,14 @@ import type { DamExtSystem } from '@anzusystems/common-admin' import { isDocId, isString, useDamConfigState, useDamCurrentUser } from '@anzusystems/common-admin' import { fetchExtSystem } from '@/services/api/coreDam/extSystemApi' import { fetchAssetLicence } from '@/services/api/coreDam/assetLicenceApi' -import type { AssetLicence } from '@/types/coreDam/AssetLicence' +import type { DamAssetLicence } from '@anzusystems/common-admin' import { fetchAsset } from '@/services/api/coreDam/assetApi' import { useAssetDetailStore } from '@/stores/coreDam/assetDetailStore' const currentExtSystemId = ref(0) const currentExtSystem = ref() -const currentAssetLicence = ref() +const currentAssetLicence = ref() const currentAssetLicenceId = ref(0) export const initCurrentExtSystemAndLicence = (loadFromAsset = false, assetId: string | undefined = undefined) => { diff --git a/src/model/coreDam/factory/AssetLicenceFactory.ts b/src/model/coreDam/factory/AssetLicenceFactory.ts index 70a91756..e9387b18 100644 --- a/src/model/coreDam/factory/AssetLicenceFactory.ts +++ b/src/model/coreDam/factory/AssetLicenceFactory.ts @@ -1,10 +1,10 @@ import { SYSTEM_CORE_DAM } from '@/model/systems' import { dateTimeNow } from '@anzusystems/common-admin' -import type { AssetLicence } from '@/types/coreDam/AssetLicence' +import type { DamAssetLicence } from '@anzusystems/common-admin' import { ENTITY } from '@/services/api/coreDam/assetLicenceApi' export function useAssetLicenceFactory() { - const createDefault = (): AssetLicence => { + const createDefault = (): DamAssetLicence => { return { id: 0, name: '', diff --git a/src/services/api/coreDam/assetLicenceApi.ts b/src/services/api/coreDam/assetLicenceApi.ts index 2f6d61d6..98298270 100644 --- a/src/services/api/coreDam/assetLicenceApi.ts +++ b/src/services/api/coreDam/assetLicenceApi.ts @@ -2,22 +2,22 @@ import { damClient } from '@/services/api/clients/damClient' import { SYSTEM_CORE_DAM } from '@/model/systems' import type { FilterBag, Pagination } from '@anzusystems/common-admin' import { apiCreateOne, apiFetchByIds, apiFetchList, apiFetchOne, apiUpdateOne } from '@anzusystems/common-admin' -import type { AssetLicence } from '@/types/coreDam/AssetLicence' +import type { DamAssetLicence } from '@anzusystems/common-admin' const END_POINT = '/adm/v1/asset-licence' export const ENTITY = 'assetLicence' export const fetchAssetLicenceListByIds = (ids: number[]) => - apiFetchByIds(damClient, ids, END_POINT, {}, SYSTEM_CORE_DAM, ENTITY) + apiFetchByIds(damClient, ids, END_POINT, {}, SYSTEM_CORE_DAM, ENTITY) export const fetchAssetLicenceList = (pagination: Pagination, filterBag: FilterBag) => - apiFetchList(damClient, END_POINT, {}, pagination, filterBag, SYSTEM_CORE_DAM, ENTITY) + apiFetchList(damClient, END_POINT, {}, pagination, filterBag, SYSTEM_CORE_DAM, ENTITY) -export const createAssetLicence = (data: AssetLicence) => - apiCreateOne(damClient, data, END_POINT, {}, SYSTEM_CORE_DAM, ENTITY) +export const createAssetLicence = (data: DamAssetLicence) => + apiCreateOne(damClient, data, END_POINT, {}, SYSTEM_CORE_DAM, ENTITY) -export const updateAssetLicence = (id: number, data: AssetLicence) => - apiUpdateOne(damClient, data, END_POINT + '/:id', { id }, SYSTEM_CORE_DAM, ENTITY) +export const updateAssetLicence = (id: number, data: DamAssetLicence) => + apiUpdateOne(damClient, data, END_POINT + '/:id', { id }, SYSTEM_CORE_DAM, ENTITY) export const fetchAssetLicence = (id: number) => - apiFetchOne(damClient, END_POINT + '/:id', { id }, SYSTEM_CORE_DAM, ENTITY) + apiFetchOne(damClient, END_POINT + '/:id', { id }, SYSTEM_CORE_DAM, ENTITY) diff --git a/src/stores/coreDam/assetLicenceStore.ts b/src/stores/coreDam/assetLicenceStore.ts index 97dd525b..8e299b8b 100644 --- a/src/stores/coreDam/assetLicenceStore.ts +++ b/src/stores/coreDam/assetLicenceStore.ts @@ -1,11 +1,11 @@ import { acceptHMRUpdate, defineStore } from 'pinia' import { useAssetLicenceFactory } from '@/model/coreDam/factory/AssetLicenceFactory' -import type { AssetLicence } from '@/types/coreDam/AssetLicence' +import type { DamAssetLicence } from '@anzusystems/common-admin' const { createDefault } = useAssetLicenceFactory() interface State { - assetLicence: AssetLicence + assetLicence: DamAssetLicence } export const useAssetLicenceOneStore = defineStore('assetLicenceOneStore', { @@ -13,7 +13,7 @@ export const useAssetLicenceOneStore = defineStore('assetLicenceOneStore', { assetLicence: createDefault(), }), actions: { - setAssetLicence(assetLicence: AssetLicence) { + setAssetLicence(assetLicence: DamAssetLicence) { this.assetLicence = assetLicence }, reset() { diff --git a/src/types/coreDam/AssetLicence.ts b/src/types/coreDam/AssetLicence.ts deleted file mode 100644 index 8f6f90dc..00000000 --- a/src/types/coreDam/AssetLicence.ts +++ /dev/null @@ -1,16 +0,0 @@ -import type { - AnzuUserAndTimeTrackingAware, - IntegerId, - IntegerIdNullable, - ResourceNameSystemAware, -} from '@anzusystems/common-admin' - -export interface AssetLicenceMinimal { - id: IntegerId - name: string -} - -export interface AssetLicence extends AssetLicenceMinimal, AnzuUserAndTimeTrackingAware, ResourceNameSystemAware { - extSystem: IntegerIdNullable - extId: string -} diff --git a/src/views/coreDam/assetLicence/components/AssetLicenceCreateButton.vue b/src/views/coreDam/assetLicence/components/AssetLicenceCreateButton.vue index 5abc792a..feb85616 100644 --- a/src/views/coreDam/assetLicence/components/AssetLicenceCreateButton.vue +++ b/src/views/coreDam/assetLicence/components/AssetLicenceCreateButton.vue @@ -5,7 +5,7 @@ import { ACreateDialog, AFormTextField, ARow, ASystemEntityScope } from '@anzusy import { SYSTEM_CORE_DAM } from '@/model/systems' import ExtSystemRemoteAutocomplete from '@/views/coreDam/extSystem/components/ExtSystemRemoteAutocomplete.vue' import { useAssetLicenceFactory } from '@/model/coreDam/factory/AssetLicenceFactory' -import type { AssetLicence } from '@/types/coreDam/AssetLicence' +import type { DamAssetLicence } from '@anzusystems/common-admin' import { useAssetLicenceValidation } from '@/views/coreDam/assetLicence/composables/assetLicenceValidation' import { createAssetLicence, ENTITY } from '@/services/api/coreDam/assetLicenceApi' @@ -20,11 +20,11 @@ withDefaults( } ) const emit = defineEmits<{ - (e: 'onSuccess', data: AssetLicence): void + (e: 'onSuccess', data: DamAssetLicence): void }>() const { createDefault } = useAssetLicenceFactory() -const assetLicence = ref(createDefault()) +const assetLicence = ref(createDefault()) const dialog = ref(false) const { v$ } = useAssetLicenceValidation(assetLicence) diff --git a/src/views/coreDam/assetLicence/components/AssetLicenceDatatable.vue b/src/views/coreDam/assetLicence/components/AssetLicenceDatatable.vue index 0adbd219..eefbc67c 100644 --- a/src/views/coreDam/assetLicence/components/AssetLicenceDatatable.vue +++ b/src/views/coreDam/assetLicence/components/AssetLicenceDatatable.vue @@ -22,9 +22,9 @@ import AssetLicenceFilter from '@/views/coreDam/assetLicence/components/AssetLic import { useAssetLicenceListFilter } from '@/model/coreDam/filter/AssetLicenceFilter' import CachedExtSystemChip from '@/views/coreDam/extSystem/components/CachedExtSystemChip.vue' import { ACL, type AclValue } from '@/types/Permission' -import type { AssetLicence } from '@/types/coreDam/AssetLicence' +import type { DamAssetLicence } from '@anzusystems/common-admin' -type DatatableItem = AssetLicence +type DatatableItem = DamAssetLicence const router = useRouter() const filter = useAssetLicenceListFilter() diff --git a/src/views/coreDam/assetLicence/composables/assetLicenceActions.ts b/src/views/coreDam/assetLicence/composables/assetLicenceActions.ts index aee53da2..2e8c946e 100644 --- a/src/views/coreDam/assetLicence/composables/assetLicenceActions.ts +++ b/src/views/coreDam/assetLicence/composables/assetLicenceActions.ts @@ -1,7 +1,7 @@ import { ref } from 'vue' import type { FilterBag, Pagination, ValueObjectOption } from '@anzusystems/common-admin' import { useAlerts } from '@anzusystems/common-admin' -import type { AssetLicence } from '@/types/coreDam/AssetLicence' +import type { DamAssetLicence } from '@anzusystems/common-admin' import { useAssetLicenceOneStore } from '@/stores/coreDam/assetLicenceStore' import { storeToRefs } from 'pinia' import { @@ -26,7 +26,7 @@ const saveButtonLoading = ref(false) const saveAndCloseButtonLoading = ref(false) export const useAssetLicenceListActions = () => { - const listItems = ref([]) + const listItems = ref([]) const fetchList = async (pagination: Pagination, filterBag: FilterBag) => { listLoading.value = true @@ -129,8 +129,8 @@ export const useAssetLicenceEditActions = () => { } export const useAssetLicenceSelectActions = () => { - const mapToValueObjectOption = (assetLicences: AssetLicence[]): ValueObjectOption[] => { - return assetLicences.map((assetLicence: AssetLicence) => ({ + const mapToValueObjectOption = (assetLicences: DamAssetLicence[]): ValueObjectOption[] => { + return assetLicences.map((assetLicence: DamAssetLicence) => ({ title: assetLicence.name, value: assetLicence.id, })) @@ -151,8 +151,8 @@ export const useAssetLicenceSelectActions = () => { } export const useAssetLicenceByExtIdSelectActions = () => { - const mapToValueObjectOption = (assetLicences: AssetLicence[]): ValueObjectOption[] => { - return assetLicences.map((assetLicence: AssetLicence) => ({ + const mapToValueObjectOption = (assetLicences: DamAssetLicence[]): ValueObjectOption[] => { + return assetLicences.map((assetLicence: DamAssetLicence) => ({ title: assetLicence.extId, value: assetLicence.id, })) diff --git a/src/views/coreDam/assetLicence/composables/assetLicenceValidation.ts b/src/views/coreDam/assetLicence/composables/assetLicenceValidation.ts index dca74eb8..4ba80248 100644 --- a/src/views/coreDam/assetLicence/composables/assetLicenceValidation.ts +++ b/src/views/coreDam/assetLicence/composables/assetLicenceValidation.ts @@ -1,12 +1,12 @@ import type { Ref } from 'vue' import { computed } from 'vue' import useVuelidate from '@vuelidate/core' -import type { AssetLicence } from '@/types/coreDam/AssetLicence' +import type { DamAssetLicence } from '@anzusystems/common-admin' import { useValidate } from '@anzusystems/common-admin' const { required, minLength } = useValidate() -export function useAssetLicenceValidation(assetLicence: Ref) { +export function useAssetLicenceValidation(assetLicence: Ref) { const rules = computed(() => ({ assetLicence: { name: { diff --git a/src/views/coreDam/assetLicence/composables/cachedAssetLicences.ts b/src/views/coreDam/assetLicence/composables/cachedAssetLicences.ts index b94bb6f5..d493d156 100644 --- a/src/views/coreDam/assetLicence/composables/cachedAssetLicences.ts +++ b/src/views/coreDam/assetLicence/composables/cachedAssetLicences.ts @@ -1,22 +1,21 @@ -import type { AssetLicence, AssetLicenceMinimal } from '@/types/coreDam/AssetLicence' -import { fetchAssetLicenceListByIds } from '@/services/api/coreDam/assetLicenceApi' -import type { IntegerId } from '@anzusystems/common-admin' +import type { DamAssetLicence, DamAssetLicenceMinimal, IntegerId } from '@anzusystems/common-admin' import { defineCached } from '@anzusystems/common-admin' +import { fetchAssetLicenceListByIds } from '@/services/api/coreDam/assetLicenceApi' -const mapFullToMinimal = (assetLicence: AssetLicence): AssetLicenceMinimal => ({ +const mapFullToMinimal = (assetLicence: DamAssetLicence): DamAssetLicenceMinimal => ({ id: assetLicence.id, name: assetLicence.name, }) -const mapIdToMinimal = (id: IntegerId): AssetLicenceMinimal => { +const mapIdToMinimal = (id: IntegerId): DamAssetLicenceMinimal => { return { id: id, name: '' } } -const { cache, fetch, add, addManual, has, get, isLoaded } = defineCached( - mapFullToMinimal, - mapIdToMinimal, - fetchAssetLicenceListByIds -) +const { cache, fetch, add, addManual, has, get, isLoaded } = defineCached< + IntegerId, + DamAssetLicence, + DamAssetLicenceMinimal +>(mapFullToMinimal, mapIdToMinimal, fetchAssetLicenceListByIds) export const useCachedAssetLicences = () => { return { diff --git a/yarn.lock b/yarn.lock index bace4766..0ab3d100 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12,9 +12,9 @@ __metadata: languageName: node linkType: hard -"@anzusystems/common-admin@npm:1.40.0-alpha19": - version: 1.40.0-alpha19 - resolution: "@anzusystems/common-admin@npm:1.40.0-alpha19" +"@anzusystems/common-admin@npm:1.40.0-alpha20": + version: 1.40.0-alpha20 + resolution: "@anzusystems/common-admin@npm:1.40.0-alpha20" peerDependencies: "@vuelidate/core": 2.0.3 "@vuelidate/validators": 2.0.4 @@ -41,7 +41,7 @@ __metadata: optional: true vue-router: optional: true - checksum: fc3780f816fd906c2373fd9f59dda70fc4340d14654ce9689052fa77ce9efc0993a2f957683b6cf374f12bdb214da3abc4c0d0cc05295b2a3fecefe70d907142 + checksum: bfdb2bb5ad561a2642af8dda9e5dcee2b3adc9ee4fc7816d87abebf2ae5e0c776054caed92f09476140de664f8beaf22d0a9a84f35f416ccaeb3914f4892f656 languageName: node linkType: hard @@ -1572,7 +1572,7 @@ __metadata: version: 0.0.0-use.local resolution: "adam-admin@workspace:." dependencies: - "@anzusystems/common-admin": "npm:1.40.0-alpha19" + "@anzusystems/common-admin": "npm:1.40.0-alpha20" "@cypress/grep": "npm:^4.0.1" "@intlify/unplugin-vue-i18n": "npm:^1.6.0" "@mdi/font": "npm:7.3.67"