Skip to content

Commit

Permalink
feat(upload): add extra file type c-archive
Browse files Browse the repository at this point in the history
  • Loading branch information
AVVS committed Mar 16, 2016
1 parent e2ce24c commit f755dd7
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 0 deletions.
24 changes: 24 additions & 0 deletions schemas/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,30 @@
}
}
},
"cappasity-archive": {
"type": "object",
"required": ["type", "contentType", "contentLength", "md5Hash"],
"additionalProperties": false,
"properties": {
"type": {
"type": "string",
"constant": "c-archive"
},
"contentType": {
"type": "string",
"constant": "application/cappasity-archive"
},
"contentLength": {
"type": "integer",
"minimum": 1,
"maximum": 2000000000
},
"md5Hash": {
"type": "string",
"pattern": "^[0-9A-Fa-f]{32}$"
}
}
},
"meta": {
"type": "object",
"required": ["name"],
Expand Down
3 changes: 3 additions & 0 deletions schemas/upload.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
},
{
"$ref": "common#/definitions/cappasity-image"
},
{
"$ref": "common#/definitions/cappasity-archive"
}
]
}
Expand Down
1 change: 1 addition & 0 deletions src/actions/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const TYPE_MAP = {
'c-bin': '.bin.gz',
'c-texture': '.jpeg',
'c-preview': '.jpeg',
'c-archive': '.zip',
};

function typeToExtension(type) {
Expand Down
1 change: 1 addition & 0 deletions src/custom/cappasity-postprocess.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const TYPE_MAP = {
'c-preview': 'preview',
'c-bin': 'model',
'c-texture': 'texture',
'c-archive': 'archive',
};

module.exports = function extractMetadata(data) {
Expand Down
1 change: 1 addition & 0 deletions src/custom/cappasity-upload-pre.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module.exports = function extractMetadata(files, username) {

assert.equal(fileTypes['c-bin'], 1, 'must contain exactly one binary upload');
assert.equal(fileTypes['c-preview'], 1, 'must contain preview');
assert.equal(fileTypes['c-archive'], 1, 'must contain prepared archive');
assert.ok(fileTypes['c-texture'] >= 1, 'must contain at least one texture');
})
.then(() => amqp.publishAndWait(getMetadata, { username, audience }))
Expand Down

0 comments on commit f755dd7

Please sign in to comment.