Skip to content

Commit

Permalink
readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronald Krist committed Mar 10, 2023
1 parent 8f56c25 commit 38af331
Showing 1 changed file with 4 additions and 50 deletions.
54 changes: 4 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,6 @@
# OARepo model builder files
# OARepo model builder drafts

Plugin adding support for working with files based on the invenio model. <br>
Files are represented as another ("file") record connected with the original parent one.
The plugin generates the file record and modifies the parent record to create connection with new file one.
The file record is specified under "files" attribute in the model yaml file, see example
in tests.
Plugin replacing the original uploading process with a one saving records into
drafts and publishing them when necessary.

The plugin runs the original model builder on the files model in "files" profile,
reusing a lot of the model builder code with different configuration, notably with different
base classes for record, service, resource and config classes.
To get an idea which code is reused, see entrypoints. For configuration changes, see model preprocessors.

## Api

The files plugin provides an api for working with files.
The api is by default accessible at {original model url}/{base record id}/files.
The api is taken from InvenioRDM, the docs are [here](https://inveniordm.docs.cern.ch/reference/rest_api_drafts_records/#record-files)

## Example

A simple record with associated files can be defined as this:
```yaml
model:
properties:
metadata:
properties:
title:
type: fulltext
status:
type: keyword
package: thesis
schema-server: 'local://'
use:
- invenio

files:
properties:
metadata:
properties:
title:
type: fulltext
package: thesis
schema-server: 'local://'
use:
- invenio_files
```
Using the api, first an
instance of the model has to be created. Then an instance of the
associated file record. The file content is then uploaded in separate step and
finally the upload must be commited.
Based on InvenioRDM process, for api documentation see the InvenioRDM [docs](https://inveniordm.docs.cern.ch/reference/rest_api_drafts_records/).

0 comments on commit 38af331

Please sign in to comment.