-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SOF-1670 Expose Endpoint To Reload Rundown #88
Changes from 5 commits
09d1f53
d0a17c9
94f95d9
0c4095b
7e1d1da
eb17bc3
0b715e6
052dda7
07159a0
6d7ed67
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -144,18 +144,28 @@ export class Connector { | |
} | ||
|
||
private setupReloadDataKoaEndpoint(): void { | ||
this.koaRouter.get('/reloadData/:rundownName', async (ctx, next): Promise<void> => { | ||
const RUNDOWN_EXTERNAL_ID_SUFFIX = '_1' | ||
const KOA_PORT: number = 3007 | ||
const RUNDOWN_EXTERNAL_ID_SUFFIX: string = '_1' | ||
|
||
this.koaRouter.post('/reloadData/:rundownName', async (context, next): Promise<void> => { | ||
const rundownName: string = context.params.rundownName | ||
if (!this.iNewsFTPHandler.iNewsWatcher) { | ||
context.status = 503 | ||
context.response.body = 'Error: iNewsWatcher is undefined' | ||
return | ||
} | ||
this.iNewsFTPHandler.iNewsWatcher?.ResyncRundown(ctx.params.rundownName + RUNDOWN_EXTERNAL_ID_SUFFIX) | ||
|
||
await next() | ||
try { | ||
context.response.body = `Attempting to reload rundown with name ${rundownName}` | ||
await this.iNewsFTPHandler.iNewsWatcher.ResyncRundown( rundownName + RUNDOWN_EXTERNAL_ID_SUFFIX) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you running lint? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've never had this issue before with linting, i will be sure to check and do it. |
||
await next() | ||
} catch (error) { | ||
context.status = 500 | ||
context.response.body = `Error: ${error}` | ||
} | ||
}) | ||
|
||
this.koaApp.use(this.koaRouter.routes()).use(this.koaRouter.allowedMethods()) | ||
|
||
this.koaApp.listen(3007, () => {}) | ||
this.koaApp.listen(KOA_PORT, () => {}) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not following REST standards (maybe that is fine).
If we want this URL to follow REST standards, it should be changed to do so.
Personally, I would prefer it, but I can see arguments for not doing it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see your point, and on Sofie Server i'd say it makes a lot of sense. Here, however, i might counter argue that because of the setup where we both actually work on playlists and rundowns to do this operation, it's difficult to just use e.g.
rundowns/reloadData/:rundownName
since it is used for both playlists and rundowns.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On another note, this is tied to our implementation of Sofie Server alone, so i will name it to fit the standard it follows!