Skip to content

Backend API

Doug Emery edited this page Feb 23, 2021 · 1 revision

Table of Contents

Introduction

The backend is a restful API powered by Ruby on Rails and MongoDB. Its responses are in JSON format.

Models

The collation structure is broken down into the following models:

  • group
  • leaf
  • side
  • note

The project model has has_many relationships to the listed models above.

Model relationships

VisColl supports nested groups. The group model may contain leaves and/or groups. This relationship is represented through group's memberIDs array field. This array is an ordered list of member ID's, which may be leaf ID's and/or group ID's. The relationship between groups and its children is two-way: leaves and groups have a parentID pointing to the parent. Root groups' parentID fields are empty. The order of the groups in a project is depicted by project's groupIDs array field which stores an ordered list of group ID's.

The property of leaves having 2 sides (recto and verso) is modelled by the rectoID and versoID fields in the leaf model.

Notes can be attached to groups, leaves and sides. This relationship is represented in the note model by the objects hash field where the keys are Group, Leaf, Recto, and Verso, and the values are arrays of ID's.

Convention for ID's

Each object ID of the collation structure models are prefixed with the name of the model. For example, a group ID may be Group_5a5fd3324cfad1e55d2db1bd and a leaf ID may be Leaf_4d9037a53f15170017340480.

Images

Images can be linked to sides. Images can either be uploaded by the user or added through a IIIF manifest url. If uploaded, the image information is stored as a record in the image collection and the actual image is stored using Shrine. The images are stored at the path viscoll-api/uploads/images. If the user wants to use images from a manifest url, the manifest information gets stored in the project model's manifests field. Note that the images of added manifests are not uploaded to VisColl but they are referenced as urls instead.

Clone this wiki locally