Skip to content

Commit

Permalink
feat(seeder): adapt seeder for Feestcafé "De BAC" 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoronex committed Feb 5, 2025
1 parent ea005ed commit 5687ed0
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/seed/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ async function createSeeder() {
const [room, bar, lounge, movingHeadsGEWIS, movingHeadsRoy] = await seedDatabase();
await seedBorrelLights(room!, bar!, lounge!, movingHeadsGEWIS!);
await seedOpeningSequence(room!, bar!, movingHeadsGEWIS!, movingHeadsRoy!);
await seedDiscoFloor(12, 8);
await seedDiscoFloor(9, 4);
}

if (require.main === module) {
Expand Down
32 changes: 28 additions & 4 deletions src/seed/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { FixedPositionCreateParams } from '../modules/lights/effects/movement/fi
import { ColorEffects } from '../modules/lights/effects/color/color-effects';
import { MovementEffects } from '../modules/lights/effects/movement/movement-effetcs';
import { TimedEvent } from '../modules/timed-events/entities';
import AuthService from '../modules/auth/auth-service';

export default async function seedDatabase() {
const timedEventsRepo = dataSource.getRepository(TimedEvent);
Expand Down Expand Up @@ -55,6 +56,7 @@ export default async function seedDatabase() {
name: 'PCGEWISINFO',
defaultHandler: GewisPosterScreenHandler.name,
});
await new AuthService().createIntegrationUser({ name: 'BPM-script' });

const rootLightsService = new RootLightsService();
const controller = await rootLightsService.createController({ name: 'GEWIS-BAR' });
Expand Down Expand Up @@ -198,8 +200,12 @@ export default async function seedDatabase() {
pars: [],
movingHeadRgbs: [],
movingHeadWheels: [
{ fixtureId: eurolite_LED_TMH_S30.id, firstChannel: 161, positionX: 0 },
{ fixtureId: eurolite_LED_TMH_S30.id, firstChannel: 177, positionX: 1 },
{ fixtureId: showtec_Kanjo_Spot10.id, firstChannel: 385, positionX: 0 },
{ fixtureId: eurolite_LED_TMH_S30.id, firstChannel: 161, positionX: 1 },
{ fixtureId: showtec_Kanjo_Spot10.id, firstChannel: 401, positionX: 2 },
{ fixtureId: showtec_Kanjo_Spot10.id, firstChannel: 417, positionX: 3 },
{ fixtureId: eurolite_LED_TMH_S30.id, firstChannel: 177, positionX: 4 },
{ fixtureId: showtec_Kanjo_Spot10.id, firstChannel: 433, positionX: 5 },
],
});
if (!gewisMHRoom) throw new Error('GEWIS MHs not created');
Expand Down Expand Up @@ -756,8 +762,26 @@ export async function seedDiscoFloor(width: number, height: number) {
});

const pars: LightsInGroup[] = [];
for (let positionY = 0; positionY < height; positionY++) {
for (let positionX = 0; positionX < width; positionX++) {
for (let positionY = 0; positionY < height * 2; positionY += 2) {
for (let positionX = 0; positionX < width * 2; positionX += 2) {
pars.push({
fixtureId: fixture.id,
firstChannel: pars.length * fixture.nrChannels + 1,
positionX: positionX + 1,
positionY: positionY + 1,
});
pars.push({
fixtureId: fixture.id,
firstChannel: pars.length * fixture.nrChannels + 1,
positionX,
positionY: positionY + 1,
});
pars.push({
fixtureId: fixture.id,
firstChannel: pars.length * fixture.nrChannels + 1,
positionX: positionX + 1,
positionY,
});
pars.push({
fixtureId: fixture.id,
firstChannel: pars.length * fixture.nrChannels + 1,
Expand Down

0 comments on commit 5687ed0

Please sign in to comment.