Skip to content

Commit

Permalink
fix(overlay): update API for emotes combo
Browse files Browse the repository at this point in the history
+ another migrate fix
  • Loading branch information
sogehige committed Jul 18, 2021
1 parent eb5260d commit 324479d
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/api/registries/overlay.ts
Expand Up @@ -15,7 +15,7 @@ import {
import { getRepository } from 'typeorm';

import {
OverlayMapper, OverlayMapperAlerts, OverlayMapperClips, OverlayMapperClipsCarousel, OverlayMapperCredits, OverlayMapperEmotes, OverlayMapperEmotesExplode, OverlayMapperEmotesFireworks, OverlayMapperInterface, OverlayMapperOBSWebsocket, OverlayMapperPolls, OverlayMappers, OverlayMapperTTS,
OverlayMapper, OverlayMapperAlerts, OverlayMapperClips, OverlayMapperClipsCarousel, OverlayMapperCredits, OverlayMapperEmotes, OverlayMapperEmotesCombo, OverlayMapperEmotesExplode, OverlayMapperEmotesFireworks, OverlayMapperInterface, OverlayMapperOBSWebsocket, OverlayMapperPolls, OverlayMappers, OverlayMapperTTS,
} from '../../database/entity/overlay';

@Route('/api/v1/overlay')
Expand Down Expand Up @@ -67,6 +67,7 @@ export class RegistryOverlayController extends Controller {
@Path() id: string,
@Body() data:
Partial<OverlayMapperAlerts>
| Partial<OverlayMapperEmotesCombo>
| Partial<OverlayMapperCredits>
| Partial<OverlayMapperClips>
| Partial<OverlayMapperEmotes>
Expand Down
11 changes: 10 additions & 1 deletion src/database/entity/overlay.ts
Expand Up @@ -86,6 +86,15 @@ export interface OverlayMapperEmotes {
},
}

export interface OverlayMapperEmotesCombo {
id: string;
value: 'emotescombo';
opts: null | {
showEmoteInOverlayThreshold: number,
hideEmoteInOverlayAfter: number,
},
}

export interface OverlayMapperEmotesFireworks {
id: string;
value: 'emotesfireworks';
Expand Down Expand Up @@ -147,7 +156,7 @@ export interface OverlayMapperOBSWebsocket {
},
}

export type OverlayMappers = OverlayMapperCredits | OverlayMapperClips | OverlayMapperAlerts | OverlayMapperEmotes | OverlayMapperEmotesExplode | OverlayMapperEmotesFireworks | OverlayMapperPolls | OverlayMapperTTS | OverlayMapperInterface | OverlayMapperOBSWebsocket | OverlayMapperClipsCarousel;
export type OverlayMappers = OverlayMapperEmotesCombo | OverlayMapperCredits | OverlayMapperClips | OverlayMapperAlerts | OverlayMapperEmotes | OverlayMapperEmotesExplode | OverlayMapperEmotesFireworks | OverlayMapperPolls | OverlayMapperTTS | OverlayMapperInterface | OverlayMapperOBSWebsocket | OverlayMapperClipsCarousel;

export const OverlayMapper = new EntitySchema<Readonly<Required<OverlayMappers>>>({
name: 'overlay_mapper',
Expand Down
Expand Up @@ -47,7 +47,7 @@ export class migrateOverlaySettings1626383147273 implements MigrationInterface {
if (item.name === 'cClipsFilter') {
item.name = 'filter';
}
if (item.name === 'cClipsLabel') {
if (item.name === 'cClipsLabel' || item.name === 'showLabel') {
item.name = 'label';
}
opts = {
Expand Down Expand Up @@ -140,7 +140,7 @@ export class migrateOverlaySettings1626383147273 implements MigrationInterface {
set(opts, 'text.lastMessage', JSON.parse(item.value));
}
if (item.name === 'cTextLastSubMessage') {
set(opts, 'text.lastSubmessage', JSON.parse(item.value));
set(opts, 'text.lastSubMessage', JSON.parse(item.value));
}
if (item.name === 'cTextStreamBy') {
set(opts, 'text.streamBy', JSON.parse(item.value));
Expand Down
Expand Up @@ -47,7 +47,7 @@ export class migrateOverlaySettings1626383147273 implements MigrationInterface {
if (item.name === 'cClipsFilter') {
item.name = 'filter';
}
if (item.name === 'cClipsLabel') {
if (item.name === 'cClipsLabel' || item.name === 'showLabel') {
item.name = 'label';
}
opts = {
Expand Down Expand Up @@ -140,7 +140,7 @@ export class migrateOverlaySettings1626383147273 implements MigrationInterface {
set(opts, 'text.lastMessage', JSON.parse(item.value));
}
if (item.name === 'cTextLastSubMessage') {
set(opts, 'text.lastSubmessage', JSON.parse(item.value));
set(opts, 'text.lastSubMessage', JSON.parse(item.value));
}
if (item.name === 'cTextStreamBy') {
set(opts, 'text.streamBy', JSON.parse(item.value));
Expand Down
Expand Up @@ -47,7 +47,7 @@ export class migrateOverlaySettings1622378375128 implements MigrationInterface {
if (item.name === 'cClipsFilter') {
item.name = 'filter';
}
if (item.name === 'cClipsLabel') {
if (item.name === 'cClipsLabel' || item.name === 'showLabel') {
item.name = 'label';
}
opts = {
Expand Down Expand Up @@ -140,7 +140,7 @@ export class migrateOverlaySettings1622378375128 implements MigrationInterface {
set(opts, 'text.lastMessage', JSON.parse(item.value));
}
if (item.name === 'cTextLastSubMessage') {
set(opts, 'text.lastSubmessage', JSON.parse(item.value));
set(opts, 'text.lastSubMessage', JSON.parse(item.value));
}
if (item.name === 'cTextStreamBy') {
set(opts, 'text.streamBy', JSON.parse(item.value));
Expand Down

0 comments on commit 324479d

Please sign in to comment.