Skip to content

Commit

Permalink
MMI-3116 Update Source and Series CBRA source
Browse files Browse the repository at this point in the history
- added is CBRA source to source and series page
- updated source and series data models
  • Loading branch information
laidaoyu committed Dec 3, 2024
1 parent 1490529 commit a06d5b9
Show file tree
Hide file tree
Showing 34 changed files with 7,565 additions and 10 deletions.
1 change: 1 addition & 0 deletions app/editor/src/features/admin/series/SeriesDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ const SeriesDetails: React.FC = () => {
<FormikCheckbox label="Is Enabled" name="isEnabled" />
<FormikCheckbox label="Use in Topics" name="useInTopics" />
<FormikCheckbox label="Automatically transcribe when saved" name="autoTranscribe" />
<FormikCheckbox label="Is CBRA Source" name="isCBRASource" />
</Col>
<Show visible={!!values.id}>
<Row>
Expand Down
7 changes: 7 additions & 0 deletions app/editor/src/features/admin/series/constants/columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,11 @@ export const columns: ITableHookColumn<ISeriesModel>[] = [
hAlign: 'center',
cell: (cell) => <CellCheckbox checked={cell.original.isEnabled} />,
},
{
label: 'Is CBRA Source',
accessor: 'isCBRASource',
width: 1,
hAlign: 'center',
cell: (cell) => <CellCheckbox checked={cell.original.isCBRASource} />,
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ export const defaultSeries: ISeriesForm = {
sortOrder: 0,
autoTranscribe: false,
useInTopics: false,
isCBRASource: false,
};
1 change: 1 addition & 0 deletions app/editor/src/features/admin/sources/SourceDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ const SourceDetails: React.FC<ISourceDetailsProps> = () => {
<FormikCheckbox label="Default filter for papers" name="configuration.isDailyPaper" />
<FormikCheckbox label="Automatically transcribe when saved" name="autoTranscribe" />
<FormikCheckbox label="Disable transcript requests" name="disableTranscribe" />
<FormikCheckbox label="Is CBRA Source" name="isCBRASource" />
</Col>
</styled.SourceDetails>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ export const defaultSource: ISourceForm = {
},
actions: [],
metrics: [],
isCBRASource: false,
};
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const generateSeries = (options: IGenerateSeriesOptions) => {
isOther: false,
autoTranscribe: false,
useInTopics: false,
isCBRASource: false,
...options.init,
};
return entity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const generateSource = (options: IGenerateSourceOptions) => {
configuration: {},
actions: [],
metrics: [],
isCBRASource: false,
...options.init,
};
return entity;
Expand Down
1 change: 1 addition & 0 deletions libs/net/dal/Configuration/SeriesConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public override void Configure(EntityTypeBuilder<Series> builder)
builder.Property(m => m.SourceId).IsRequired(false);
builder.Property(m => m.AutoTranscribe).IsRequired();
builder.Property(m => m.UseInTopics).IsRequired();
builder.Property(m => m.IsCBRASource).IsRequired(false);

builder.HasOne(m => m.Source).WithMany(m => m.Series).HasForeignKey(m => m.SourceId).OnDelete(DeleteBehavior.Cascade);
builder.HasMany(m => m.MediaTypeSearchMappings).WithMany(m => m.SeriesSearchMappings).UsingEntity<SeriesMediaTypeSearchMapping>();
Expand Down
1 change: 1 addition & 0 deletions libs/net/dal/Configuration/SourceConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public override void Configure(EntityTypeBuilder<Source> builder)
builder.Property(m => m.DisableTranscribe).IsRequired();
builder.Property(m => m.UseInTopics).IsRequired();
builder.Property(m => m.Configuration).IsRequired().HasColumnType("jsonb").HasDefaultValueSql("'{}'::jsonb");
builder.Property(m => m.IsCBRASource).IsRequired(false);

builder.HasOne(m => m.Owner).WithMany().HasForeignKey(m => m.OwnerId).OnDelete(DeleteBehavior.SetNull);
builder.HasOne(m => m.License).WithMany(m => m.Sources).HasForeignKey(m => m.LicenseId).OnDelete(DeleteBehavior.Restrict);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
DO $$
BEGIN

ALTER TABLE public."source" DROP COLUMN "is_cbra_source";
ALTER TABLE public."series" DROP COLUMN "is_cbra_source";

END $$;
7 changes: 7 additions & 0 deletions libs/net/dal/Migrations/1.3.8/Up/PostUp/00-source-series.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
DO $$
BEGIN

ALTER TABLE public."source" ADD COLUMN "is_cbra_source" boolean NOT NULL DEFAULT false;
ALTER TABLE public."series" ADD COLUMN "is_cbra_source" boolean NOT NULL DEFAULT false;

END $$;
Loading

0 comments on commit a06d5b9

Please sign in to comment.