Types used in couchDb ===================== reference --------- This type is used when one document points to another document. The advantage of using this type as opposed to a raw string with a document id is that it is possible, using a view, to figure out all relationships between documents. { nunaliit_type: 'reference' ,doc: } actionstamp ----------- This type is used to keep track of an action performed by a user at a specific time. Usual keys: nunaliit_created and nunaliit_last_updated { nunaliit_type: 'actionstamp' ,name: ,time: ,action: } geometry -------- This type is used to store a geometry. This type is saved under the key: nunaliit_geometry { nunaliit_type: 'geometry' ,wkt: ,bbox: [ , , , ] } layers ------ Layers are associated with documents in an array under the key: nunaliit_layers { nunaliit_layers: [ ,... ] } layerDefinition --------------- Objects of type layerDefinition are used to define layers that are store in the database. A layer definition object is saved under the key nunaliit_layer_definition and follows the following pattern: { nunaliit_layer_definition: { nunaliit_type: 'layerDefinition' ,id: ,name: ,bbox: [ , , , ] } } contribution ------------ This type is used when comments are to be applied to other document. These comments are called 'contributions'. Contributions are saved under the key: 'nunaliit_contribution' { nunaliit_type: 'contribution' ,title: ,description: ,reference: ,reply: } attachment_descriptions ----------------------- This is an object under the key 'nunaliit_attachments'. The keys under nunaliit_attachments.files match the keys found under _attachments. This object is used to store meta data about the files attached to the document. { nunaliit_type: 'attachment_descriptions' ,files: { : { attachmentName: ,fileClass: ,mimeType: ,mimeEncoding: ,status: ,mediaFile: ,originalName: ,width: ,height: ,size: ,conversionPerformed: ,thumbnail: ,original: { mediaFile: ,width: ,height: ,size: ,mimeType: ,mimeEncoding: } ,source: ,data: } ,... } } The upload process is as follows: - file is uploaded and saved in a directory, called the media directory - the document where the file is destined is updated with the following information: - an attachmentName is computed - a file description is created and attached to nunaliit_attachments.files[attachmentName] - originalName - status: 'submitted' - original.mediaFile - original.size - server detects that a new file was submitted and the file is analyzed - fileClass - status: 'analyzed' - original.width - original.height - original.mimeType - original.mimeEncoding - server detects that a file has been analyzed. It calls the appropriate plugin for conversion. In the case of a multimedia file (fileClass: image,audio,video), the file is converted to appropriate codec with needed dimensions. Then, if needed, a thumbnail is created. The file descriptor is updated appropriately: - status: 'waiting for approval' - mimeType - mimeEncoding - mediaFile - width - height - size - conversionPerformed: true - thumbnail (set to attachmentName that is the thumbnail, if appropriate) If a thumbnail is created, a new file descriptor is created: - originalName (same as uploaded file) - fileClass: 'image' - status: 'waiting for approval' - mimeType - mimeEncoding - mediaFile - width - height - size - source (set to attachmentName that is the original file) - Administrator approves the file - status: 'approved' - server detects a a file was approved and updates the document. Uploads the file from the media directory to the document, using the appropriate attachmentName - status: 'attached'