Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
volar committed Nov 15, 2023
1 parent 1c904cc commit ff4bc94
Show file tree
Hide file tree
Showing 28 changed files with 123 additions and 211 deletions.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
"cy:open": "CYPRESS_CACHE_FOLDER='node_modules/.cache/Cypress' yarn cypress open -C cypress/config/cypress.config.ts"
},
"dependencies": {
"@anzusystems/common-admin": "^1.38.0",
"@anzusystems/common-admin": "^1.39.0",
"@mdi/font": "7.3.67",
"@vuelidate/core": "^2.0.3",
"@vuelidate/validators": "^2.0.4",
"@vueuse/core": "10.6.1",
"@vueuse/integrations": "10.6.1",
"axios": "^1.6.1",
"axios": "^1.6.2",
"js-sha1": "^0.6.0",
"jwt-decode": "^4.0.0",
"pinia": "^2.1.7",
Expand All @@ -38,7 +38,7 @@
"vue-cropperjs": "^5.0.0",
"vue-i18n": "^9.6.5",
"vue-router": "^4.2.5",
"vuetify": "^3.4.0"
"vuetify": "^3.4.1"
},
"devDependencies": {
"@cypress/grep": "^4.0.1",
Expand All @@ -47,12 +47,12 @@
"@types/node": "^18.18.9",
"@types/sortablejs": "^1.15.5",
"@types/uuid": "^9.0.7",
"@typescript-eslint/parser": "^6.10.0",
"@typescript-eslint/parser": "^6.11.0",
"@vitejs/plugin-vue": "^4.4.1",
"@vue/eslint-config-prettier": "^8.0.0",
"@vue/eslint-config-typescript": "^12.0.0",
"@vue/tsconfig": "^0.1.3",
"cypress": "^13.5.0",
"cypress": "^13.5.1",
"cypress-downloadfile": "1.2.3",
"cypress-mochawesome-reporter": "^3.6.1",
"eslint": "8.52.0",
Expand Down
65 changes: 0 additions & 65 deletions src/model/coreDam/factory/UploadQueueItemFactory.ts

This file was deleted.

6 changes: 3 additions & 3 deletions src/services/DamConfigDistributionCustomFormService.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { type Ref, ref } from 'vue'
import { fetchDistributionCustomFormElements } from '@/services/api/coreDam/assetCustomFormApi'
import type { DistributionServiceName } from '@/types/coreDam/DamConfig'
import type { DamDistributionServiceName } from '@anzusystems/common-admin'

Check failure on line 3 in src/services/DamConfigDistributionCustomFormService.ts

View workflow job for this annotation

GitHub Actions / Lint (18, ubuntu-latest)

Module '"@anzusystems/common-admin"' has no exported member 'DamDistributionServiceName'.

export const damConfigDistributionCustomFormElements: Ref<Record<DistributionServiceName, any>> = ref({})
export const damConfigDistributionCustomFormElements: Ref<Record<DamDistributionServiceName, any>> = ref({})

export const loadDamConfigDistributionCustomFormElements = (distributionServiceName: DistributionServiceName) => {
export const loadDamConfigDistributionCustomFormElements = (distributionServiceName: DamDistributionServiceName) => {
return new Promise((resolve, reject) => {
if (damConfigDistributionCustomFormElements.value[distributionServiceName]) {
resolve(true)
Expand Down
4 changes: 2 additions & 2 deletions src/services/api/coreDam/assetCustomFormApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { apiFetchOne } from '@anzusystems/common-admin'
import { damClient } from '@/services/api/clients/damClient'
import { SYSTEM_CORE_DAM } from '@/model/systems'
import type { DamAssetType } from '@/model/coreDam/valueObject/DamAssetType'
import type { DistributionServiceName } from '@/types/coreDam/DamConfig'
import type { DamDistributionServiceName } from '@anzusystems/common-admin'

Check failure on line 6 in src/services/api/coreDam/assetCustomFormApi.ts

View workflow job for this annotation

GitHub Actions / Lint (18, ubuntu-latest)

Module '"@anzusystems/common-admin"' has no exported member 'DamDistributionServiceName'.

const END_POINT = '/adm/v1/asset-custom-form'
const ENTITY = 'assetCustomForm'
Expand All @@ -19,7 +19,7 @@ export const fetchAssetCustomFormElements = (extSystem: IntegerId, assetType: Da
)

// todo limit set to 100 for now, add load for pagination?
export const fetchDistributionCustomFormElements = (distributionService: DistributionServiceName) =>
export const fetchDistributionCustomFormElements = (distributionService: DamDistributionServiceName) =>
apiFetchOne<{ data: CustomDataFormElement[] }>(
damClient,
END_POINT + '/distribution-service/:distributionService/element?order[position]=asc&limit=100',
Expand Down
4 changes: 2 additions & 2 deletions src/services/api/coreDam/distributionApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type {
DistributionJwItem,
DistributionYoutubeItem,
} from '@/types/coreDam/Distribution'
import type { DistributionServiceName } from '@/types/coreDam/DamConfig'
import type { DamDistributionServiceName } from '@anzusystems/common-admin'

Check failure on line 11 in src/services/api/coreDam/distributionApi.ts

View workflow job for this annotation

GitHub Actions / Lint (18, ubuntu-latest)

Module '"@anzusystems/common-admin"' has no exported member 'DamDistributionServiceName'.

const END_POINT = '/adm/v1/distribution'
export const ENTITY = 'distribution'
Expand Down Expand Up @@ -54,7 +54,7 @@ export const fetchAssetFileDistributionList = <
ENTITY
)

export const distributionIsAuthorized = (distributionServiceName: DistributionServiceName) =>
export const distributionIsAuthorized = (distributionServiceName: DamDistributionServiceName) =>
apiFetchOne<DistributionAuthorized>(
damClient,
END_POINT + '/:distributionServiceName/authorized',
Expand Down
4 changes: 2 additions & 2 deletions src/services/api/coreDam/distributionCustomApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { DocId } from '@anzusystems/common-admin'
import { apiCreateOne, apiDeleteOne, apiFetchOne, apiUpdateOne } from '@anzusystems/common-admin'
import { damClient } from '@/services/api/clients/damClient'
import { SYSTEM_CORE_DAM } from '@/model/systems'
import type { DistributionServiceName } from '@/types/coreDam/DamConfig'
import type { DamDistributionServiceName } from '@anzusystems/common-admin'

Check failure on line 5 in src/services/api/coreDam/distributionCustomApi.ts

View workflow job for this annotation

GitHub Actions / Lint (18, ubuntu-latest)

Module '"@anzusystems/common-admin"' has no exported member 'DamDistributionServiceName'.
import type { DistributionCustomCreateRedistributeDto, DistributionCustomItem } from '@/types/coreDam/Distribution'

const END_POINT = '/adm/v1/custom-distribution'
Expand Down Expand Up @@ -30,7 +30,7 @@ export const redistributeCustomDistribution = (distributionId: DocId, data: Dist

export const prepareFormDataCustomDistribution = (
assetFileId: DocId,
distributionServiceName: DistributionServiceName
distributionServiceName: DamDistributionServiceName
) =>
apiFetchOne<DistributionCustomItem>(
damClient,
Expand Down
4 changes: 2 additions & 2 deletions src/services/api/coreDam/distributionJwApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { DocId } from '@anzusystems/common-admin'
import { apiCreateOne, apiFetchOne, apiUpdateOne } from '@anzusystems/common-admin'
import { damClient } from '@/services/api/clients/damClient'
import { SYSTEM_CORE_DAM } from '@/model/systems'
import type { DistributionServiceName } from '@/types/coreDam/DamConfig'
import type { DamDistributionServiceName } from '@anzusystems/common-admin'

Check failure on line 5 in src/services/api/coreDam/distributionJwApi.ts

View workflow job for this annotation

GitHub Actions / Lint (18, ubuntu-latest)

Module '"@anzusystems/common-admin"' has no exported member 'DamDistributionServiceName'.
import type { DistributionJwCreateRedistributeDto, DistributionJwItem } from '@/types/coreDam/Distribution'

const END_POINT = '/adm/v1/jw-distribution'
Expand All @@ -28,7 +28,7 @@ export const redistributeJwDistribution = (distributionId: DocId, data: Distribu
ENTITY
)

export const prepareFormDataJwDistribution = (assetFileId: DocId, distributionServiceName: DistributionServiceName) =>
export const prepareFormDataJwDistribution = (assetFileId: DocId, distributionServiceName: DamDistributionServiceName) =>
apiFetchOne<DistributionJwItem>(
damClient,
END_POINT + '/asset-file/:assetFileId/prepare-payload/:distributionServiceName',
Expand Down
12 changes: 6 additions & 6 deletions src/services/api/coreDam/distributionYoutubeApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from '@anzusystems/common-admin'
import { damClient } from '@/services/api/clients/damClient'
import { SYSTEM_CORE_DAM } from '@/model/systems'
import type { DistributionServiceName } from '@/types/coreDam/DamConfig'
import type { DamDistributionServiceName } from '@anzusystems/common-admin'

Check failure on line 12 in src/services/api/coreDam/distributionYoutubeApi.ts

View workflow job for this annotation

GitHub Actions / Lint (18, ubuntu-latest)

Module '"@anzusystems/common-admin"' has no exported member 'DamDistributionServiceName'.
import type {
DistributionAuthUrl,
DistributionYoutubeCreateRedistributeDto,
Expand Down Expand Up @@ -46,7 +46,7 @@ export const redistributeYoutubeDistribution = (

export const prepareFormDataYoutubeDistribution = (
assetFileId: DocId,
distributionServiceName: DistributionServiceName
distributionServiceName: DamDistributionServiceName
) =>
apiFetchOne<DistributionYoutubeItem>(
damClient,
Expand All @@ -56,7 +56,7 @@ export const prepareFormDataYoutubeDistribution = (
ENTITY
)

export const getYoutubeAuthUrl = (distributionServiceName: DistributionServiceName) =>
export const getYoutubeAuthUrl = (distributionServiceName: DamDistributionServiceName) =>
apiFetchOne<DistributionAuthUrl>(
damClient,
END_POINT + '/:distributionServiceName/auth-url',
Expand All @@ -65,7 +65,7 @@ export const getYoutubeAuthUrl = (distributionServiceName: DistributionServiceNa
ENTITY
)

export const fetchYoutubeLanguages = (distributionServiceName: DistributionServiceName) => {
export const fetchYoutubeLanguages = (distributionServiceName: DamDistributionServiceName) => {
const pagination = usePagination()
return apiFetchList<YoutubeLanguage[]>(
damClient,
Expand All @@ -78,7 +78,7 @@ export const fetchYoutubeLanguages = (distributionServiceName: DistributionServi
)
}

export const fetchYoutubePlaylists = (distributionServiceName: DistributionServiceName, forceReload = false) => {
export const fetchYoutubePlaylists = (distributionServiceName: DamDistributionServiceName, forceReload = false) => {
const pagination = usePagination()
return apiFetchList<YoutubePlaylist[]>(
damClient,
Expand All @@ -91,7 +91,7 @@ export const fetchYoutubePlaylists = (distributionServiceName: DistributionServi
)
}

export const logoutYoutube = (distributionServiceName: DistributionServiceName) =>
export const logoutYoutube = (distributionServiceName: DamDistributionServiceName) =>
apiFetchOne<any>(
damClient,
END_POINT + '/:distributionServiceName/logout',
Expand Down
12 changes: 0 additions & 12 deletions src/services/upload/mimeTypeService.ts

This file was deleted.

4 changes: 2 additions & 2 deletions src/stores/coreDam/distributionCategoryStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import { useDistributionCategoryFactory } from '@/model/coreDam/factory/Distribu
import type { DistributionCategory } from '@/types/coreDam/DistributionCategory'
import type { DistributionCategorySelect } from '@/types/coreDam/DistributionCategorySelect'
import type { DistributionCategoryOption } from '@/types/coreDam/DistributionCategoryOption'
import type { DistributionServiceName } from '@/types/coreDam/DamConfig'
import type { DamDistributionServiceName } from '@anzusystems/common-admin'

Check failure on line 6 in src/stores/coreDam/distributionCategoryStore.ts

View workflow job for this annotation

GitHub Actions / Lint (18, ubuntu-latest)

Module '"@anzusystems/common-admin"' has no exported member 'DamDistributionServiceName'.

const { createDefault } = useDistributionCategoryFactory()

interface State {
distributionCategory: DistributionCategory
distributionCategorySelects: DistributionCategorySelect[]
distributionCategorySelectedOptions: Partial<Record<DistributionServiceName, DistributionCategoryOption | null>>
distributionCategorySelectedOptions: Partial<Record<DamDistributionServiceName, DistributionCategoryOption | null>>
}

export const useDistributionCategoryOneStore = defineStore('distributionCategoryOneStore', {
Expand Down
10 changes: 5 additions & 5 deletions src/stores/coreDam/distributionListStore.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { acceptHMRUpdate, defineStore } from 'pinia'
import type { DistributionCustomItem, DistributionJwItem, DistributionYoutubeItem } from '@/types/coreDam/Distribution'
import type { DistributionServiceName } from '@/types/coreDam/DamConfig'
import type { DamDistributionServiceName } from '@anzusystems/common-admin'

Check failure on line 3 in src/stores/coreDam/distributionListStore.ts

View workflow job for this annotation

GitHub Actions / Lint (18, ubuntu-latest)

Module '"@anzusystems/common-admin"' has no exported member 'DamDistributionServiceName'.
import type { DocId } from '@anzusystems/common-admin'
import { isNull } from '@anzusystems/common-admin'
import { DistributionStatus } from '@/model/coreDam/valueObject/DistributionStatus'
Expand All @@ -22,7 +22,7 @@ export const useDistributionListStore = defineStore('damDistributionListStore',
}),
getters: {
getDistributionAuth: (state) => {
return (distributionService: DistributionServiceName) => {
return (distributionService: DamDistributionServiceName) => {
const foundIndex = state.auth.findIndex((item) => item.distributionService === distributionService)
if (foundIndex > -1) return state.auth[foundIndex]
return null
Expand All @@ -39,7 +39,7 @@ export const useDistributionListStore = defineStore('damDistributionListStore',
setList(items: Array<DistributionJwItem | DistributionYoutubeItem | DistributionCustomItem>) {
this.list = items
},
authorizationMessage(distributionService: DistributionServiceName, success: boolean) {
authorizationMessage(distributionService: DamDistributionServiceName, success: boolean) {
const found = this.getDistributionAuth(distributionService)
if (found) {
found.status = success ? DistributionAuthStatus.Success : DistributionAuthStatus.Error
Expand Down Expand Up @@ -73,7 +73,7 @@ export const useDistributionListStore = defineStore('damDistributionListStore',
}
}
},
setAuthStatus(distributionService: DistributionServiceName, status = DistributionAuthStatus.Idle) {
setAuthStatus(distributionService: DamDistributionServiceName, status = DistributionAuthStatus.Idle) {
const authItem = this.getDistributionAuth(distributionService)
if (authItem) {
authItem.status = status
Expand All @@ -84,7 +84,7 @@ export const useDistributionListStore = defineStore('damDistributionListStore',
resetList() {
this.list = []
},
resetAuth(distributionService: DistributionServiceName | null = null) {
resetAuth(distributionService: DamDistributionServiceName | null = null) {
if (isNull(distributionService)) {
this.auth = []
return
Expand Down
9 changes: 4 additions & 5 deletions src/stores/coreDam/uploadQueuesStore.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { acceptHMRUpdate, defineStore } from 'pinia'
import type { AssetFileNullable } from '@anzusystems/common-admin'
import { type AssetFileNullable, getAssetTypeByMimeType, useUploadQueueItemFactory } from '@anzusystems/common-admin'

Check failure on line 2 in src/stores/coreDam/uploadQueuesStore.ts

View workflow job for this annotation

GitHub Actions / Lint (18, ubuntu-latest)

Module '"@anzusystems/common-admin"' has no exported member 'getAssetTypeByMimeType'.

Check failure on line 2 in src/stores/coreDam/uploadQueuesStore.ts

View workflow job for this annotation

GitHub Actions / Lint (18, ubuntu-latest)

'"@anzusystems/common-admin"' has no exported member named 'useUploadQueueItemFactory'. Did you mean 'UploadQueueItemType'?
import {
type AssetDetailItemDto,
type AssetFileFailReason,
Expand All @@ -15,9 +15,8 @@ import {
import { uploadStop, useUpload } from '@/services/upload/uploadService'
import { fetchImageFile } from '@/services/api/coreDam/imageApi'
import { fetchAsset, fetchAssetListByIds } from '@/services/api/coreDam/assetApi'
import type { UploadQueue } from '@/types/coreDam/UploadQueue'
import type { UploadQueue } from '@anzusystems/common-admin'
import { DamAssetStatus } from '@/model/coreDam/valueObject/DamAssetStatus'
import { getAssetTypeByMimeType } from '@/services/upload/mimeTypeService'
import { DamAssetType } from '@/model/coreDam/valueObject/DamAssetType'
import { fetchAudioFile } from '@/services/api/coreDam/audioApi'
import { fetchVideoFile } from '@/services/api/coreDam/videoApi'
Expand All @@ -26,12 +25,12 @@ import type { AssetExternalProviderId, AssetExternalProviderListDto } from '@/ty
import { externalProviderImport } from '@/services/upload/externalProviderImportService'
import { useExternalProviders } from '@/composables/system/externalProviders'
import { useCurrentAssetLicence } from '@/composables/system/currentExtSystem'
import { useUploadQueueItemFactory } from '@/model/coreDam/factory/UploadQueueItemFactory'
import { useCachedAuthors } from '@/views/coreDam/author/composables/cachedAuthors'
import { useCachedKeywords } from '@/views/coreDam/keyword/composables/cachedKeywords'
import { getAuthorConflicts, updateNewNames } from '@/services/AssetSuggestionsService'
import { useAssetDetailStore } from '@/stores/coreDam/assetDetailStore'
import { fileTypeFix } from '@/services/fileType'
import { damConfigExtSystem } from '@/services/DamConfigExtSystemService'

interface State {
queues: { [queueId: string]: UploadQueue }
Expand Down Expand Up @@ -124,7 +123,7 @@ export const useUploadQueuesStore = defineStore('damUploadQueuesStore', {
async addByFiles(queueId: string, files: File[]) {
const { currentAssetLicenceId } = useCurrentAssetLicence()
for await (const file of files) {
const type = getAssetTypeByMimeType(fileTypeFix(file))
const type = getAssetTypeByMimeType(fileTypeFix(file), damConfigExtSystem)
if (!type) continue
const queueItem = createDefault(
'file_' + file.name,
Expand Down
9 changes: 4 additions & 5 deletions src/types/coreDam/DamConfig.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { DamAssetType } from '@/model/coreDam/valueObject/DamAssetType'
import type { DistributionStatus } from '@/model/coreDam/valueObject/DistributionStatus'
import type { DamDistributionServiceName } from '@anzusystems/common-admin'

export enum DistributionServiceType {
Youtube = 'youtubeDistribution',
Expand Down Expand Up @@ -47,8 +48,6 @@ export enum UserAuthType {
Default = JsonCredentials,
}

export type DistributionServiceName = string

export type ExternalProviderAssetName = string

export type ExternalProviderAssetConfig = Record<ExternalProviderAssetName, { listingLimit: number; title: string }>
Expand All @@ -74,14 +73,14 @@ export enum DistributionRequirementStrategy {
export interface DistributionRequirementsConfig {
title: string
requiredAuth: boolean
blockedBy: Array<DistributionServiceName>
blockedBy: Array<DamDistributionServiceName>
categorySelect: DistributionRequirementsCategorySelectConfig
strategy: DistributionRequirementStrategy
}

export interface DistributionConfig {
distributionServices: Array<DistributionServiceName>
distributionRequirements: Record<DistributionServiceName, DistributionRequirementsConfig>
distributionServices: Array<DamDistributionServiceName>
distributionRequirements: Record<DamDistributionServiceName, DistributionRequirementsConfig>
}

export interface ExtSystemConfig {
Expand Down
Loading

0 comments on commit ff4bc94

Please sign in to comment.