[x] Add a published (bool NOT NULL DEFAULT false (I think, I'm not sure on the syntax)) attribute to the blockmodule table.
[x] Update all the models we are using on the backend to also have that field.
[x] Add a route for publishing a module. The route should be "PUT /api/modules/publish" and the token is passed in the body to the route. I. e. the body looks like this:
{
"token": "my-fabulous-token"
}
[x] Add a route for unpublishing a module. The route should be "PUT /api/modules/unpublish" and the token is passed in the body of the route. I. e. the body looks like this:
"token": "my-fabulous-token"
[x] Add a route for getting all plugins that are published as a JSON array. The route should be "GET /api/modules". This returns an array of all published plugins WITHOUT their tokens. WITHOUT THEIR TOKENS!!!! WITHOUT THEIR TOKENS!!!!!!!!!!!!!!!!!!!!!!!!
[x] Add a table installedplugin that has the following attributes:
– niicuserid BIGINT NOT NULL
– blockmoduleid BIGINT NOT NULL
and a constraint that makes BOTH of these a PRIMARY KEY.
This table contains every module that any user has installed.
[x] Add a route for "installing" a module for a user. This route should be "PUT /api/modules/:blockmoduleid/:userid." When a module is shown for a user, an entry is added to the installedplugin table with the user id and the block module id. Of course, you should check if the user and the block module both exist.
[x] Add a route for "uninstalling" a module for a user. This route should be "DELETE /api/modules/:blockmoduleid/:userid." This route just deletes the entry from the installedplugin table. Don't forget to also check if both IDs exist.
HINT: You don't have to check if the IDs exist manually, just use a try-catch block!
[x] Use HTTP files to define and test the interface.
[x] Add a
published
(bool NOT NULL DEFAULT false
(I think, I'm not sure on the syntax)) attribute to theblockmodule
table.[x] Update all the models we are using on the backend to also have that field.
[x] Add a route for publishing a module. The route should be "PUT /api/modules/publish" and the token is passed in the body to the route. I. e. the body looks like this:
[x] Add a route for unpublishing a module. The route should be "PUT /api/modules/unpublish" and the token is passed in the body of the route. I. e. the body looks like this:
[x] Add a route for getting all plugins that are published as a JSON array. The route should be "GET /api/modules". This returns an array of all published plugins WITHOUT their tokens. WITHOUT THEIR TOKENS!!!! WITHOUT THEIR TOKENS!!!!!!!!!!!!!!!!!!!!!!!!
[x] Add a table
installedplugin
that has the following attributes:–
niicuserid BIGINT NOT NULL
–blockmoduleid BIGINT NOT NULL
and a constraint that makes BOTH of these a
PRIMARY KEY
. This table contains every module that any user has installed.[x] Add a route for "installing" a module for a user. This route should be "PUT /api/modules/:blockmoduleid/:userid." When a module is shown for a user, an entry is added to the
installedplugin
table with the user id and the block module id. Of course, you should check if the user and the block module both exist.[x] Add a route for "uninstalling" a module for a user. This route should be "DELETE /api/modules/:blockmoduleid/:userid." This route just deletes the entry from the
installedplugin
table. Don't forget to also check if both IDs exist.HINT: You don't have to check if the IDs exist manually, just use a try-catch block!