Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,23 @@ paths:
"200":
description: "ok"
x-swagger-router-controller: "Brick"
/brick/public/{id}:
get:
tags:
- "brick"
summary: "Get specific public brick by id"
operationId: "brickPublicIdGET"
parameters:
- name: "id"
in: "path"
required: true
type: "integer"
responses:
"200":
description: "ok"
schema:
$ref: "#/definitions/Brick"
x-swagger-router-controller: "Brick"
/brick/build/{id}:
post:
tags:
Expand Down
11 changes: 11 additions & 0 deletions controllers/Brick.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,17 @@ module.exports.brickIdGET = function brickIdGET (req, res, next) {
});
};

module.exports.brickPublicIdGET = function brickPublicIdGET (req, res, next) {
var id = req.swagger.params['id'].value;
Brick.brickPublicIdGET(id)
.then(function (response) {
utils.writeJson(res, response);
})
.catch(function (response) {
utils.writeJson(res, response);
});
};

module.exports.brickPublishIdPOST = function brickPublishIdPOST (req, res, next) {
var id = req.swagger.params['id'].value;
Brick.brickPublishIdPOST(id)
Expand Down
56 changes: 56 additions & 0 deletions service/BrickService.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,62 @@ exports.brickIdGET = function(id) {
}


/**
* Get specific public brick by id
*
* id Integer
* returns Brick
**/
exports.brickPublicIdGET = function(id) {
return new Promise(function(resolve, reject) {
var examples = {};
examples['application/json'] = {
"alternativeSubject" : "alternativeSubject",
"subTopic" : "subTopic",
"brief" : "brief",
"synthesis" : "synthesis",
"openQuestion" : "openQuestion",
"subject" : {
"color" : "color",
"name" : "name",
"checked" : true,
"id" : 5,
"bricksCount" : 5,
"publishedBricksCount" : 2
},
"created" : "2000-01-23T04:56:07.000+00:00",
"questions" : [ {
"contentBlocks" : "contentBlocks",
"id" : 7,
"questionType" : "None",
"order" : 9
}, {
"contentBlocks" : "contentBlocks",
"id" : 7,
"questionType" : "None",
"order" : 9
} ],
"revisionLog" : "revisionLog",
"title" : "title",
"subjectId" : 1,
"attemptsCount" : 6,
"brickLength" : "0",
"alternativeTopics" : "alternativeTopics",
"topic" : "topic",
"prep" : "prep",
"id" : 0,
"locked" : true,
"updated" : "2000-01-23T04:56:07.000+00:00"
};
if (Object.keys(examples).length > 0) {
resolve(examples[Object.keys(examples)[0]]);
} else {
resolve();
}
});
}


/**
* Set brick to publish status
*
Expand Down