import IContentController from 'pop-api/src/controllers/IContentController.js'
IContentController
Extends:
Direct Subclass:
Implements:
Direct Implemented:
Interface for handling the content endpoints.
Test:
Method Summary
Public Methods | ||
public abstract |
createContent(req: IncomingMessage, res: ServerResponse, next: Function): Promise<Object, Error> Create a new content item. |
|
public abstract |
deleteContent(req: IncomingMessage, res: ServerResponse, next: Function): Promise<Object, Error> Delete a content item. |
|
public abstract |
getContent(req: IncomingMessage, res: ServerResponse, next: Function): Promise<Object, Error> Get a content item based on the id. |
|
public abstract |
getContents(req: IncomingMessage, res: ServerResponse, next: Function): Promise<Array<string>, Object> Default method to get content pages. |
|
public abstract |
getPage(req: IncomingMessage, res: ServerResponse, next: Function): Promise<Array<Object>, Error> Default method to get a page of content. |
|
public abstract |
getRandomContent(req: IncomingMessage, res: ServerResponse, next: Function): Promise<Object, Error> Default method to get a random content item. |
|
public abstract |
sortContent(sort: string, order: number): Object Default method to sort the items. |
|
public abstract |
updateContent(req: IncomingMessage, res: ServerResponse, next: Function): Promise<Object, Error> Update the info of one content item. |
Inherited Summary
From class IController | ||
public abstract |
registerRoutes(router: Object, PopApi: PopApi): undefined Default method to register the routes. |
Public Methods
public abstract createContent(req: IncomingMessage, res: ServerResponse, next: Function): Promise<Object, Error> source
Create a new content item.
Params:
Name | Type | Attribute | Description |
req | IncomingMessage |
|
The incoming message request object. |
res | ServerResponse |
|
The server response object. |
next | Function |
|
The next function to move to the next middleware. |
Throw:
Using default method: 'createContent'. |
public abstract deleteContent(req: IncomingMessage, res: ServerResponse, next: Function): Promise<Object, Error> source
Delete a content item.
Params:
Name | Type | Attribute | Description |
req | IncomingMessage |
|
The incoming message request object. |
res | ServerResponse |
|
The server response object. |
next | Function |
|
The next function to move to the next middleware. |
Throw:
Using default method: 'deleteContent'. |
public abstract getContent(req: IncomingMessage, res: ServerResponse, next: Function): Promise<Object, Error> source
Get a content item based on the id.
Params:
Name | Type | Attribute | Description |
req | IncomingMessage |
|
The incoming message request object. |
res | ServerResponse |
|
The server response object. |
next | Function |
|
The next function to move to the next middleware. |
Throw:
Using default method: 'getContent'. |
public abstract getContents(req: IncomingMessage, res: ServerResponse, next: Function): Promise<Array<string>, Object> source
Default method to get content pages.
Params:
Name | Type | Attribute | Description |
req | IncomingMessage |
|
The incoming message request object. |
res | ServerResponse |
|
The server response object. |
next | Function |
|
The next function to move to the next middleware. |
Throw:
Using default method: 'getContents'. |
public abstract getPage(req: IncomingMessage, res: ServerResponse, next: Function): Promise<Array<Object>, Error> source
Default method to get a page of content.
Params:
Name | Type | Attribute | Description |
req | IncomingMessage |
|
The incoming message request object. |
res | ServerResponse |
|
The server response object. |
next | Function |
|
The next function to move to the next middleware. |
Throw:
Using default method: 'getPage'. |
public abstract getRandomContent(req: IncomingMessage, res: ServerResponse, next: Function): Promise<Object, Error> source
Default method to get a random content item.
Params:
Name | Type | Attribute | Description |
req | IncomingMessage |
|
The incoming message request object. |
res | ServerResponse |
|
The server response object. |
next | Function |
|
The next function to move to the next middleware. |
Throw:
Using default method: 'getRandomContent'. |
public abstract sortContent(sort: string, order: number): Object source
Default method to sort the items.
Throw:
Using default method: 'sortContent' |
public abstract updateContent(req: IncomingMessage, res: ServerResponse, next: Function): Promise<Object, Error> source
Update the info of one content item.
Params:
Name | Type | Attribute | Description |
req | IncomingMessage |
|
The incoming message request object. |
res | ServerResponse |
|
The server response object. |
next | Function |
|
The next function to move to the next middleware. |
Throw:
Using default method: 'updateContent'. |