Skip to content

Commit e22cc60

Browse files
authored
Merge pull request #167 from Hazeolation/feature/144-add-all-match-colors
Feature/144 add all match colors
2 parents 7184ddd + 10331c7 commit e22cc60

46 files changed

Lines changed: 747 additions & 94 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Backend/DSB.StreamBackend/Dtos/BroadcastStateDto.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,14 @@ public class BroadcastStateDto
8888
/// Gets or sets the start time of the match
8989
/// </summary>
9090
public DateTime StartTime { get; set; }
91+
92+
/// <summary>
93+
/// Gets or sets the current id of a `MatchColor` object in FE
94+
/// </summary>
95+
public int CurrentColorsId { get; set; } = 0;
96+
97+
/// <summary>
98+
/// Gets or sets if color lock is currently active or not
99+
/// </summary>
100+
public bool ColorLockActive { get; set; } = false;
91101
}

Backend/DSB.StreamBackend/Migrations/20260623051911_AddCommentatorBoxTimeData.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ protected override void Up(MigrationBuilder migrationBuilder)
2727
migrationBuilder.InsertData(
2828
table: "CommentatorBoxTimeData",
2929
columns: new[] { "Id", "ShowDisplayIntervalInSeconds", "HideDisplayIntervalInSeconds" },
30-
values: new object[] { 1, 5, 50 }
30+
values: new object[] { 1, 50, 5 }
3131
);
3232
}
3333

Backend/DSB.StreamBackend/Migrations/20260715064427_addMatchColorSwitching.Designer.cs

Lines changed: 215 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
using Microsoft.EntityFrameworkCore.Migrations;
2+
3+
#nullable disable
4+
5+
namespace DSB.StreamBackend.Migrations
6+
{
7+
/// <inheritdoc />
8+
public partial class addMatchColorSwitching : Migration
9+
{
10+
/// <inheritdoc />
11+
protected override void Up(MigrationBuilder migrationBuilder)
12+
{
13+
migrationBuilder.AddColumn<bool>(
14+
name: "ColorLockActive",
15+
table: "BroadcastStates",
16+
type: "INTEGER",
17+
nullable: false,
18+
defaultValue: false);
19+
20+
migrationBuilder.AddColumn<int>(
21+
name: "CurrentColorsId",
22+
table: "BroadcastStates",
23+
type: "INTEGER",
24+
nullable: false,
25+
defaultValue: 0);
26+
27+
migrationBuilder.UpdateData(
28+
table: "BroadcastStates",
29+
keyColumn: "Id",
30+
keyValue: 1,
31+
columns: new[] { "ColorLockActive", "CurrentColorsId" },
32+
values: new object[] { false, 0 });
33+
}
34+
35+
/// <inheritdoc />
36+
protected override void Down(MigrationBuilder migrationBuilder)
37+
{
38+
migrationBuilder.DropColumn(
39+
name: "ColorLockActive",
40+
table: "BroadcastStates");
41+
42+
migrationBuilder.DropColumn(
43+
name: "CurrentColorsId",
44+
table: "BroadcastStates");
45+
}
46+
}
47+
}

Backend/DSB.StreamBackend/Migrations/StreamToolDbContextModelSnapshot.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ protected override void BuildModel(ModelBuilder modelBuilder)
2626
b.Property<bool>("AlphaIsLeft")
2727
.HasColumnType("INTEGER");
2828

29+
b.Property<bool>("ColorLockActive")
30+
.HasColumnType("INTEGER");
31+
2932
b.Property<string>("Commentator1")
3033
.IsRequired()
3134
.HasColumnType("TEXT");
@@ -34,6 +37,9 @@ protected override void BuildModel(ModelBuilder modelBuilder)
3437
.IsRequired()
3538
.HasColumnType("TEXT");
3639

40+
b.Property<int>("CurrentColorsId")
41+
.HasColumnType("INTEGER");
42+
3743
b.Property<int>("Division")
3844
.HasColumnType("INTEGER");
3945

@@ -85,8 +91,10 @@ protected override void BuildModel(ModelBuilder modelBuilder)
8591
{
8692
Id = 1,
8793
AlphaIsLeft = true,
94+
ColorLockActive = false,
8895
Commentator1 = "",
8996
Commentator2 = "",
97+
CurrentColorsId = 0,
9098
Division = 1,
9199
ScoreAlpha = 0,
92100
ScoreBravo = 0,

Backend/DSB.StreamBackend/Models/BroadcastStateEntity.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,14 @@ public class BroadcastStateEntity
9595
/// Gets or sets the start time of the match
9696
/// </summary>
9797
public DateTime StartTime { get; set; }
98+
99+
/// <summary>
100+
/// Gets or sets the current id of a `MatchColor` object in FE
101+
/// </summary>
102+
public int CurrentColorsId { get; set; } = 0;
103+
104+
/// <summary>
105+
/// Gets or sets if color lock is currently active or not
106+
/// </summary>
107+
public bool ColorLockActive { get; set; } = false;
98108
}

Backend/DSB.StreamBackend/Services/BroadcastStateService.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ public async Task<BroadcastStateDto> UpdateStateAsync(BroadcastStateDto dto)
8181

8282
entity.StartTime = dto.StartTime;
8383

84+
entity.CurrentColorsId = dto.CurrentColorsId;
85+
entity.ColorLockActive = dto.ColorLockActive;
86+
8487
UpdateMaps(entity, dto.Maps);
8588

8689
await db.SaveChangesAsync();
@@ -257,7 +260,9 @@ private static BroadcastStateDto ToDto(BroadcastStateEntity entity)
257260
Season = entity.Season,
258261
Division = entity.Division,
259262
Week = entity.Week,
260-
StartTime = entity.StartTime
263+
StartTime = entity.StartTime,
264+
CurrentColorsId = entity.CurrentColorsId,
265+
ColorLockActive = entity.ColorLockActive
261266
};
262267
}
263268
}

0 commit comments

Comments
 (0)