Commit 927ac48a authored by Stefan Probst's avatar Stefan Probst
Browse files

fix: adjust to objectid=>persistentId change, pass dto to workflow edit form

parent fa3ebff7
Pipeline #188014 failed with stage
in 13 seconds
......@@ -74,28 +74,32 @@ export function convertToInitialFormValues(
}
}),
/**
* `persistentId` => `objectId`
* Only ids needed.
*/
relatedItems: item.relatedItems?.map((relation) => {
return {
...relation,
objectId: relation.persistentId,
id: relation.id,
persistentId: relation.persistentId,
relation: relation.relation && { code: relation.relation.code },
}
}),
/**
* Only ids needed. Also, fields are non-null.
*/
externalIds: item.externalIds?.map((id) => {
return {
serviceIdentifier: id.identifierService?.code ?? '',
identifier: id.identifier ?? '',
const identifierService = { code: id.identifierService?.code }
const identifier = id.identifier!
const externalId = {
identifier,
serviceIdentifier: identifierService,
}
return externalId
}),
/**
* Only id needed.
*/
source: {
id: item.source?.id,
source: item.source && {
id: item.source.id,
},
sourceItemId: item.sourceItemId,
}
......
......@@ -37,7 +37,7 @@ export type ActorCore = {
}
export type ActorExternalIdCore = {
serviceIdentifier: string
serviceIdentifier: ActorSourceId
identifier: string
}
......@@ -45,6 +45,10 @@ export type ActorId = {
id?: number /* int64 */
}
export type ActorSourceId = {
code?: string
}
export type ActorDto = {
id?: number /* int64 */
name?: string
......@@ -136,29 +140,24 @@ export type PaginatedVocabularies = {
vocabularies?: Array<VocabularyBasicDto>
}
export type PropertyTypeDto = {
export type PropertyTypeCore = {
code?: string
label?: string
type?: 'concept' | 'string' | 'url' | 'int' | 'float' | 'date'
groupName?: string
hidden?: boolean
ord?: number /* int32 */
allowedVocabularies?: Array<VocabularyBasicDto>
allowedVocabularies?: Array<string>
}
export type PropertyTypeCore = {
export type PropertyTypeDto = {
code?: string
label?: string
type?: 'concept' | 'string' | 'url' | 'int' | 'float' | 'date'
groupName?: string
hidden?: boolean
ord?: number /* int32 */
allowedVocabularies?: Array<string>
}
export type PaginatedPropertyTypes = {
hits?: number /* int64 */
count?: number /* int32 */
page?: number /* int32 */
perpage?: number /* int32 */
pages?: number /* int32 */
propertyTypes?: Array<PropertyTypeDto>
allowedVocabularies?: Array<VocabularyBasicDto>
}
export type PropertyTypeReorder = {
......@@ -170,6 +169,15 @@ export type PropertyTypesReordering = {
shifts: Array<PropertyTypeReorder>
}
export type PaginatedPropertyTypes = {
hits?: number /* int64 */
count?: number /* int32 */
page?: number /* int32 */
perpage?: number /* int32 */
pages?: number /* int32 */
propertyTypes?: Array<PropertyTypeDto>
}
export type PaginatedSources = {
hits?: number /* int64 */
count?: number /* int32 */
......@@ -247,6 +255,11 @@ export type ItemExternalIdDto = {
identifier?: string
}
export type ItemMediaDto = {
metadata?: MediaDetails
caption?: string
}
export type ItemRelationDto = {
code?: string
label?: string
......@@ -257,13 +270,21 @@ export type ItemSourceDto = {
label?: string
}
export type PaginatedWorkflows = {
hits?: number /* int64 */
count?: number /* int32 */
page?: number /* int32 */
perpage?: number /* int32 */
pages?: number /* int32 */
workflows?: Array<WorkflowDto>
export type ItemThumbnailId = {
mediaId?: string /* uuid */
}
export type MediaDetails = {
mediaId?: string /* uuid */
category?: 'image' | 'video' | 'object' | 'thumbnail'
location?: MediaLocation
filename?: string
mimeType?: string
hasThumbnail?: boolean
}
export type MediaLocation = {
sourceUrl?: string /* url */
}
export type PropertyDto = {
......@@ -316,6 +337,8 @@ export type StepDto = {
source?: SourceBasicDto
sourceItemId?: string
relatedItems?: Array<RelatedItemDto>
media?: Array<ItemMediaDto>
thumbnail?: ItemThumbnailId
informationContributor?: UserDto
lastInfoUpdate?: string
status?:
......@@ -333,7 +356,7 @@ export type UserDto = {
id?: number /* int64 */
username?: string
displayName?: string
enabled?: boolean
status?: 'during-registration' | 'enabled' | 'locked'
registrationDate?: string
role?: 'contributor' | 'system-contributor' | 'moderator' | 'administrator'
email?: string
......@@ -360,6 +383,8 @@ export type WorkflowDto = {
source?: SourceBasicDto
sourceItemId?: string
relatedItems?: Array<RelatedItemDto>
media?: Array<ItemMediaDto>
thumbnail?: ItemThumbnailId
informationContributor?: UserDto
lastInfoUpdate?: string
status?:
......@@ -374,6 +399,15 @@ export type WorkflowDto = {
composedOf?: Array<StepDto>
}
export type PaginatedWorkflows = {
hits?: number /* int64 */
count?: number /* int32 */
page?: number /* int32 */
perpage?: number /* int32 */
pages?: number /* int32 */
workflows?: Array<WorkflowDto>
}
export type ActorRoleId = {
code?: string
}
......@@ -390,10 +424,19 @@ export type ItemContributorId = {
}
export type ItemExternalIdCore = {
serviceIdentifier: string
serviceIdentifier: ItemExternalIdId
identifier: string
}
export type ItemExternalIdId = {
code?: string
}
export type ItemMediaCore = {
mediaId?: string /* uuid */
caption?: string
}
export type ItemRelationId = {
code?: string
}
......@@ -413,7 +456,7 @@ export type PropertyTypeId = {
}
export type RelatedItemCore = {
objectId?: string
persistentId?: string
relation?: ItemRelationId
}
......@@ -434,6 +477,8 @@ export type WorkflowCore = {
externalIds?: Array<ItemExternalIdCore>
properties?: Array<PropertyCore>
relatedItems?: Array<RelatedItemCore>
media?: Array<ItemMediaCore>
thumbnail?: ItemThumbnailId
accessibleAt?: Array<string>
source?: SourceId
sourceItemId?: string
......@@ -448,6 +493,8 @@ export type StepCore = {
externalIds?: Array<ItemExternalIdCore>
properties?: Array<PropertyCore>
relatedItems?: Array<RelatedItemCore>
media?: Array<ItemMediaCore>
thumbnail?: ItemThumbnailId
accessibleAt?: Array<string>
source?: SourceId
sourceItemId?: string
......@@ -475,6 +522,8 @@ export type ToolDto = {
source?: SourceBasicDto
sourceItemId?: string
relatedItems?: Array<RelatedItemDto>
media?: Array<ItemMediaDto>
thumbnail?: ItemThumbnailId
informationContributor?: UserDto
lastInfoUpdate?: string
status?:
......@@ -488,15 +537,6 @@ export type ToolDto = {
newerVersions?: Array<ItemBasicDto>
}
export type PaginatedTools = {
hits?: number /* int64 */
count?: number /* int32 */
page?: number /* int32 */
perpage?: number /* int32 */
pages?: number /* int32 */
tools?: Array<ToolDto>
}
export type ToolCore = {
label?: string
version?: string
......@@ -506,11 +546,22 @@ export type ToolCore = {
externalIds?: Array<ItemExternalIdCore>
properties?: Array<PropertyCore>
relatedItems?: Array<RelatedItemCore>
media?: Array<ItemMediaCore>
thumbnail?: ItemThumbnailId
accessibleAt?: Array<string>
source?: SourceId
sourceItemId?: string
}
export type PaginatedTools = {
hits?: number /* int64 */
count?: number /* int32 */
page?: number /* int32 */
perpage?: number /* int32 */
pages?: number /* int32 */
tools?: Array<ToolDto>
}
export type CheckedCount = {
count?: number /* int64 */
checked?: boolean
......@@ -592,6 +643,37 @@ export type SuggestedSearchPhrases = {
suggestions?: Array<string>
}
export type MediaSourceCore = {
code?: string
serviceUrl?: string
mediaCategory?: 'image' | 'video' | 'object' | 'thumbnail'
ord?: number /* int32 */
}
export type MediaSourceDto = {
code?: string
serviceUrl?: string
mediaCategory?: 'image' | 'video' | 'object' | 'thumbnail'
}
export type Resource = {
readable?: boolean
url?: string /* url */
filename?: string
description?: string
uri?: string /* uri */
open?: boolean
file?: string /* binary */
inputStream?: unknown
}
export type MediaUploadInfo = {
mediaId?: string /* uuid */
filename?: string
mimeType?: string
nextChunkNo?: number /* int32 */
}
export type OAuthRegistrationData = {
id?: number /* int64 */
displayName?: string
......@@ -645,6 +727,8 @@ export type TrainingMaterialDto = {
source?: SourceBasicDto
sourceItemId?: string
relatedItems?: Array<RelatedItemDto>
media?: Array<ItemMediaDto>
thumbnail?: ItemThumbnailId
informationContributor?: UserDto
lastInfoUpdate?: string
status?:
......@@ -660,6 +744,15 @@ export type TrainingMaterialDto = {
dateLastUpdated?: string
}
export type PaginatedTrainingMaterials = {
hits?: number /* int64 */
count?: number /* int32 */
page?: number /* int32 */
perpage?: number /* int32 */
pages?: number /* int32 */
trainingMaterials?: Array<TrainingMaterialDto>
}
export type TrainingMaterialCore = {
label?: string
version?: string
......@@ -669,6 +762,8 @@ export type TrainingMaterialCore = {
externalIds?: Array<ItemExternalIdCore>
properties?: Array<PropertyCore>
relatedItems?: Array<RelatedItemCore>
media?: Array<ItemMediaCore>
thumbnail?: ItemThumbnailId
accessibleAt?: Array<string>
source?: SourceId
sourceItemId?: string
......@@ -676,15 +771,6 @@ export type TrainingMaterialCore = {
dateLastUpdated?: string
}
export type PaginatedTrainingMaterials = {
hits?: number /* int64 */
count?: number /* int32 */
page?: number /* int32 */
perpage?: number /* int32 */
pages?: number /* int32 */
trainingMaterials?: Array<TrainingMaterialDto>
}
export type ItemRelatedItemDto = {
subject?: ItemBasicDto
object?: ItemBasicDto
......@@ -709,20 +795,13 @@ export type ItemCommentDto = {
dateLastUpdated?: string
}
export type PublicationCore = {
label?: string
version?: string
description?: string
licenses?: Array<LicenseId>
contributors?: Array<ItemContributorId>
externalIds?: Array<ItemExternalIdCore>
properties?: Array<PropertyCore>
relatedItems?: Array<RelatedItemCore>
accessibleAt?: Array<string>
source?: SourceId
sourceItemId?: string
dateCreated?: string
dateLastUpdated?: string
export type PaginatedPublications = {
hits?: number /* int64 */
count?: number /* int32 */
page?: number /* int32 */
perpage?: number /* int32 */
pages?: number /* int32 */
publications?: Array<PublicationDto>
}
export type PublicationDto = {
......@@ -746,6 +825,8 @@ export type PublicationDto = {
source?: SourceBasicDto
sourceItemId?: string
relatedItems?: Array<RelatedItemDto>
media?: Array<ItemMediaDto>
thumbnail?: ItemThumbnailId
informationContributor?: UserDto
lastInfoUpdate?: string
status?:
......@@ -761,13 +842,22 @@ export type PublicationDto = {
dateLastUpdated?: string
}
export type PaginatedPublications = {
hits?: number /* int64 */
count?: number /* int32 */
page?: number /* int32 */
perpage?: number /* int32 */
pages?: number /* int32 */
publications?: Array<PublicationDto>
export type PublicationCore = {
label?: string
version?: string
description?: string
licenses?: Array<LicenseId>
contributors?: Array<ItemContributorId>
externalIds?: Array<ItemExternalIdCore>
properties?: Array<PropertyCore>
relatedItems?: Array<RelatedItemCore>
media?: Array<ItemMediaCore>
thumbnail?: ItemThumbnailId
accessibleAt?: Array<string>
source?: SourceId
sourceItemId?: string
dateCreated?: string
dateLastUpdated?: string
}
export type DatasetDto = {
......@@ -791,6 +881,8 @@ export type DatasetDto = {
source?: SourceBasicDto
sourceItemId?: string
relatedItems?: Array<RelatedItemDto>
media?: Array<ItemMediaDto>
thumbnail?: ItemThumbnailId
informationContributor?: UserDto
lastInfoUpdate?: string
status?:
......@@ -824,6 +916,8 @@ export type DatasetCore = {
externalIds?: Array<ItemExternalIdCore>
properties?: Array<PropertyCore>
relatedItems?: Array<RelatedItemCore>
media?: Array<ItemMediaCore>
thumbnail?: ItemThumbnailId
accessibleAt?: Array<string>
source?: SourceId
sourceItemId?: string
......@@ -1167,95 +1261,6 @@ export function useDeleteActorRole(
return useMutation(deleteActorRole, options)
}
export namespace GetActors {
export type QueryParameters = {
q?: string
page?: number /* int32 */
perpage?: number /* int32 */
}
export namespace Response {
export type Success = PaginatedActors
export type Error = unknown
}
}
export async function getActors(
queryParams: GetActors.QueryParameters,
requestOptions?: RequestOptions<GetActors.Response.Success>,
): Promise<GetActors.Response.Success> {
return request({
path: `/api/actors`,
baseUrl: undefined,
query: queryParams,
options: {
method: 'get',
body: undefined,
headers: {},
},
returnType: 'json',
hooks: requestOptions?.hooks,
token: requestOptions?.token,
})
}
export function useGetActors(
queryParams: GetActors.QueryParameters,
options?: UseQueryOptions<
GetActors.Response.Success,
GetActors.Response.Error
>,
requestOptions?: RequestOptions<GetActors.Response.Success>,
): UseQueryResult<GetActors.Response.Success, GetActors.Response.Error> {
return useQuery(
['getActors', queryParams],
() => getActors(queryParams, requestOptions),
options,
)
}
export namespace CreateActor {
export namespace Response {
export type Success = ActorDto
export type Error = unknown
}
export type RequestBody = ActorCore
}
export async function createActor([body, requestOptions]: [
body: CreateActor.RequestBody,
requestOptions?: RequestOptions<CreateActor.Response.Success>,
]): Promise<CreateActor.Response.Success> {
return request({
path: `/api/actors`,
baseUrl: undefined,
query: undefined,
options: {
method: 'post',
body: JSON.stringify(body),
headers: { 'Content-Type': 'application/json' },
},
returnType: 'json',
hooks: requestOptions?.hooks,
token: requestOptions?.token,
})
}
export function useCreateActor(
options?: UseMutationOptions<
CreateActor.Response.Success,
CreateActor.Response.Error,
[CreateActor.RequestBody, RequestOptions<CreateActor.Response.Success>],
unknown
>,
): UseMutationResult<
CreateActor.Response.Success,
CreateActor.Response.Error,
[CreateActor.RequestBody, RequestOptions<CreateActor.Response.Success>],
unknown
> {
return useMutation(createActor, options)
}
export namespace GetActor {
export type PathParameters = {
id: number /* int64 */
......@@ -1397,22 +1402,111 @@ export function useDeleteActor(
return useMutation(deleteActor, options)
}
export namespace GetActorSource {
export type PathParameters = {
sourceCode: string
export namespace GetActors {
export type QueryParameters = {
q?: string
page?: number /* int32 */
perpage?: number /* int32 */
}
export namespace Response {
export type Success = ActorSourceDto
export type Success = PaginatedActors
export type Error = unknown
}
}
export async function getActorSource(
pathParams: GetActorSource.PathParameters,
requestOptions?: RequestOptions<GetActorSource.Response.Success>,
): Promise<GetActorSource.Response.Success> {
export async function getActors(
queryParams: GetActors.QueryParameters,
requestOptions?: RequestOptions<GetActors.Response.Success>,
): Promise<GetActors.Response.Success> {
return request({
path: `/api/actor-sources/${encodeURIComponent(pathParams.sourceCode)}`,
path: `/api/actors`,
baseUrl: undefined,
query: queryParams,
options: {
method: 'get',
body: undefined,
headers: {},
},
returnType: 'json',
hooks: requestOptions?.hooks,
token: requestOptions?.token,
})
}
export function useGetActors(
queryParams: GetActors.QueryParameters,
options?: UseQueryOptions<
GetActors.Response.Success,
GetActors.Response.Error
>,
requestOptions?: RequestOptions<GetActors.Response.Success>,
): UseQueryResult<GetActors.Response.Success, GetActors.Response.Error> {
return useQuery(
['getActors', queryParams],
() => getActors(queryParams, requestOptions),
options,
)
}
export namespace CreateActor {
export namespace Response {
export type Success = ActorDto
export type Error = unknown
}
export type RequestBody = ActorCore
}
export async function createActor([body, requestOptions]: [
body: CreateActor.RequestBody,
requestOptions?: RequestOptions<CreateActor.Response.Success>,
]): Promise<CreateActor.Response.Success> {
return request({
path: `/api/actors`,
baseUrl: undefined,
query