Skip to content

Commit 42c151a

Browse files
committed
Alter Content.SourceURL length
1 parent 1a4dc2c commit 42c151a

File tree

8 files changed

+7548
-6
lines changed

8 files changed

+7548
-6
lines changed

libs/net/dal/Configuration/ContentConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public override void Configure(EntityTypeBuilder<Content> builder)
2929
builder.Property(m => m.IsHidden).IsRequired();
3030
builder.Property(m => m.IsApproved).IsRequired();
3131
builder.Property(m => m.IsPrivate).IsRequired();
32-
builder.Property(m => m.SourceUrl).IsRequired().HasMaxLength(500);
32+
builder.Property(m => m.SourceUrl).IsRequired().HasMaxLength(1000);
3333
builder.Property(m => m.Headline).IsRequired().HasMaxLength(500);
3434
builder.Property(m => m.Page).IsRequired().HasMaxLength(20);
3535
builder.Property(m => m.Summary).IsRequired().HasColumnType("text");

libs/net/dal/Migrations/20250407151823_1.3.25.Designer.cs

Lines changed: 7498 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
using Microsoft.EntityFrameworkCore.Migrations;
2+
using TNO.DAL;
3+
4+
#nullable disable
5+
6+
namespace TNO.DAL.Migrations
7+
{
8+
/// <inheritdoc />
9+
public partial class _1325 : SeedMigration
10+
{
11+
/// <inheritdoc />
12+
protected override void Up(MigrationBuilder migrationBuilder)
13+
{
14+
PreUp(migrationBuilder);
15+
migrationBuilder.AlterColumn<string>(
16+
name: "source_url",
17+
table: "content",
18+
type: "character varying(1000)",
19+
maxLength: 1000,
20+
nullable: false,
21+
oldClrType: typeof(string),
22+
oldType: "character varying(500)",
23+
oldMaxLength: 500);
24+
PostUp(migrationBuilder);
25+
}
26+
27+
/// <inheritdoc />
28+
protected override void Down(MigrationBuilder migrationBuilder)
29+
{
30+
PreDown(migrationBuilder);
31+
migrationBuilder.AlterColumn<string>(
32+
name: "source_url",
33+
table: "content",
34+
type: "character varying(500)",
35+
maxLength: 500,
36+
nullable: false,
37+
oldClrType: typeof(string),
38+
oldType: "character varying(1000)",
39+
oldMaxLength: 1000);
40+
PostDown(migrationBuilder);
41+
}
42+
}
43+
}

libs/net/dal/Migrations/TNOContextModelSnapshot.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,8 +1040,8 @@ protected override void BuildModel(ModelBuilder modelBuilder)
10401040

10411041
b.Property<string>("SourceUrl")
10421042
.IsRequired()
1043-
.HasMaxLength(500)
1044-
.HasColumnType("character varying(500)")
1043+
.HasMaxLength(1000)
1044+
.HasColumnType("character varying(1000)")
10451045
.HasColumnName("source_url");
10461046

10471047
b.Property<int>("Status")

libs/net/models/Areas/Editor/Models/Content/ContentModel.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ public class ContentModel : AuditColumnsModel
153153
/// <summary>
154154
/// get/set - The source URL.
155155
/// </summary>
156-
[MaxLength(500)]
157156
public string SourceUrl { get; set; } = "";
158157

159158
/// <summary>

libs/net/models/Areas/Services/Models/Content/ContentModel.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ public class ContentModel : AuditColumnsModel
149149
/// <summary>
150150
/// get/set - The source URL.
151151
/// </summary>
152-
[MaxLength(500)]
153152
public string SourceUrl { get; set; } = "";
154153

155154
/// <summary>

openshift/kustomize/tekton/base/tasks/git-conditions.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ spec:
6363
git checkout $(params.GIT_SOURCE)
6464
6565
# TODO: Make the branch equal to the GIT_REF
66+
# git reset --hard origin/master
6667
git pull
6768
git show -s
6869

services/net/content/ContentManager.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,8 @@ private async Task ProcessSourceContentAsync(ConsumeResult<string, SourceContent
548548
model.MediaTypeId = ingests?.MediaTypeId ?? throw new InvalidOperationException($"Unable to find an ingest for the topic '{result.Topic}'");
549549
}
550550

551+
if (content?.SourceUrl.Length > 1000) this.Logger.LogWarning("Content.SourceUrl is greater than maximum length. UID={uid}", content.Uid);
552+
551553
content ??= new ContentModel();
552554
content.Uid = model.Uid;
553555
content.Status = model.Status;
@@ -564,7 +566,7 @@ private async Task ProcessSourceContentAsync(ConsumeResult<string, SourceContent
564566
content.Summary = String.IsNullOrWhiteSpace(summary) ? "" : summary;
565567
content.Body = !String.IsNullOrWhiteSpace(body) ? body : model.ContentType == ContentType.AudioVideo ? "" : summary;
566568
content.IsApproved = model.ContentType == ContentType.AudioVideo && model.PublishedOn.HasValue && model.Status == ContentStatus.Publish && !String.IsNullOrWhiteSpace(model.Body);
567-
content.SourceUrl = model.Link;
569+
content.SourceUrl = model.Link.Length > 1000 ? model.Link[..1000] : model.Link;
568570
content.PublishedOn = model.PublishedOn;
569571
content.Section = model.Section;
570572
content.Byline = string.Join(",", model.Authors.Select(a => a.Name[0..Math.Min(a.Name.Length, 200)])); // TODO: Temporary workaround to deal with regression issue in Syndication Service.

0 commit comments

Comments
 (0)