1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-06-30 05:41:41 +02:00

data structure cleanup, initial values

This commit is contained in:
Matthias Kretschmann 2020-08-03 12:26:00 +02:00
parent 24a7bdbd81
commit d72d798b06
Signed by: m
GPG Key ID: 606EEEF3C479A91F
6 changed files with 21 additions and 29 deletions

View File

@ -5,12 +5,9 @@ import {
ServiceMetadata
} from '@oceanprotocol/lib'
export declare type AccessType = 'Download' | 'Compute'
export interface AdditionalInformationMarket extends AdditionalInformation {
links?: File[]
termsAndConditions: boolean
access: AccessType | string
}
export interface MetadataMarket extends Metadata {

View File

@ -36,7 +36,7 @@ export default function FilesInput(props: InputProps): ReactElement {
return (
<>
{typeof field.value === 'object' ? (
{field && typeof field.value === 'object' ? (
<FileInfo file={field.value[0]} removeItem={removeItem} />
) : (
<FileInput

View File

@ -16,11 +16,9 @@ export default function PublishForm({
const { ocean, account } = useOcean()
const { publishStepText, isLoading } = usePublish()
const {
values,
status,
setStatus,
isValid,
touched,
setErrors,
setTouched,
resetForm,

View File

@ -16,8 +16,7 @@ export function transformPublishFormToMetadata(
tags,
links,
termsAndConditions,
files,
access
files
} = data
const metadata: MetadataMarket = {
@ -38,8 +37,7 @@ export function transformPublishFormToMetadata(
// links: {
// url: links
// },
termsAndConditions,
access: access || 'Download'
termsAndConditions
},
curation: AssetModel.curation
}

View File

@ -5,21 +5,20 @@ const AssetModel: MetadataMarket = {
// https://github.com/oceanprotocol/OEPs/tree/master/8
main: {
type: 'dataset',
name: '',
dateCreated: '',
author: '',
license: '',
name: undefined,
dateCreated: undefined,
author: undefined,
license: undefined,
files: []
},
additionalInformation: {
description: '',
copyrightHolder: '',
tags: [],
links: [],
description: undefined,
copyrightHolder: undefined,
tags: undefined,
links: undefined,
// custom items
termsAndConditions: false,
access: 'Download'
termsAndConditions: false
},
curation: {
rating: 0,

View File

@ -25,18 +25,18 @@ export const validationSchema = Yup.object().shape<MetadataPublishForm>({
})
export const initialValues: MetadataPublishForm = {
name: '',
author: '',
name: undefined,
author: undefined,
price: {
cost: 1,
tokensToMint: 1
},
files: '',
description: '',
license: '',
access: '',
files: undefined,
description: undefined,
license: undefined,
access: undefined,
termsAndConditions: false,
copyrightHolder: '',
tags: '',
links: ''
copyrightHolder: undefined,
tags: undefined,
links: undefined
}