-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from JaloliddinDeveloper/users/JaloliddinDevelo…
…per/data-add DATA: Models & Migrate Video metadata
- Loading branch information
Showing
12 changed files
with
285 additions
and
22 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
UsefulTime.Api/Brokers/Storages/IStorageBroker.VedioMetadata.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
//================================================= | ||
//Copyright (c) Coalition of Good-Hearted Engineers | ||
//Free To Use To Find Comfort and Pease | ||
//================================================= | ||
namespace UsefulTime.Api.Brokers.Storages | ||
{ | ||
public partial interface IStorageBroker | ||
{ | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
//================================================= | ||
//Copyright (c) Coalition of Good-Hearted Engineers | ||
//Free To Use To Find Comfort and Pease | ||
//================================================= | ||
namespace UsefulTime.Api.Brokers.Storages | ||
{ | ||
public partial interface IStorageBroker | ||
{ } | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
UsefulTime.Api/Brokers/Storages/StorageBroker.VedioMetadata.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
//================================================= | ||
//Copyright (c) Coalition of Good-Hearted Engineers | ||
//Free To Use To Find Comfort and Pease | ||
//================================================= | ||
using Microsoft.EntityFrameworkCore; | ||
using UsefulTime.Api.Models.VideoMetadatas; | ||
|
||
namespace UsefulTime.Api.Brokers.Storages | ||
{ | ||
public partial class StorageBroker | ||
{ | ||
public DbSet<VideoMetadata> VideoMetadatas { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
//================================================= | ||
//Copyright (c) Coalition of Good-Hearted Engineers | ||
//Free To Use To Find Comfort and Pease | ||
//================================================= | ||
using EFxceptions; | ||
using Microsoft.EntityFrameworkCore; | ||
|
||
namespace UsefulTime.Api.Brokers.Storages | ||
{ | ||
public partial class StorageBroker:EFxceptionsContext,IStorageBroker | ||
{ | ||
private readonly IConfiguration configuration; | ||
|
||
public StorageBroker(IConfiguration configuration) | ||
{ | ||
this.configuration = configuration; | ||
Database.Migrate(); | ||
} | ||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) | ||
{ | ||
string connectionString = | ||
this.configuration.GetConnectionString("DefaultConnection"); | ||
|
||
optionsBuilder.UseSqlServer(connectionString); | ||
} | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
UsefulTime.Api/Migrations/20240524150024_CreateAllTablesInitialize.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
39 changes: 39 additions & 0 deletions
39
UsefulTime.Api/Migrations/20240524150024_CreateAllTablesInitialize.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
//================================================= | ||
//Copyright (c) Coalition of Good-Hearted Engineers | ||
//Free To Use To Find Comfort and Pease | ||
//================================================= | ||
using System; | ||
using Microsoft.EntityFrameworkCore.Migrations; | ||
|
||
|
||
namespace UsefulTime.Api.Migrations | ||
{ | ||
|
||
public partial class CreateAllTablesInitialize : Migration | ||
{ | ||
protected override void Up(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.CreateTable( | ||
name: "VideoMetadatas", | ||
columns: table => new | ||
{ | ||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), | ||
Title = table.Column<string>(type: "nvarchar(max)", nullable: false), | ||
Description = table.Column<string>(type: "nvarchar(max)", nullable: false), | ||
BlobPath = table.Column<string>(type: "nvarchar(max)", nullable: false), | ||
Thubnail = table.Column<string>(type: "nvarchar(max)", nullable: false), | ||
CreatedDate = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false), | ||
UpdatedDate = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false) | ||
}, | ||
constraints: table => | ||
{ | ||
table.PrimaryKey("PK_VideoMetadatas", x => x.Id); | ||
}); | ||
} | ||
protected override void Down(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.DropTable( | ||
name: "VideoMetadatas"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// <auto-generated /> | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.EntityFrameworkCore.Infrastructure; | ||
using UsefulTime.Api.Brokers.Storages; | ||
|
||
namespace UsefulTime.Api.Migrations | ||
{ | ||
[DbContext(typeof(StorageBroker))] | ||
partial class StorageBrokerModelSnapshot : ModelSnapshot | ||
{ | ||
protected override void BuildModel(ModelBuilder modelBuilder) | ||
{ | ||
modelBuilder | ||
.HasAnnotation("ProductVersion", "8.0.5") | ||
.HasAnnotation("Relational:MaxIdentifierLength", 128); | ||
|
||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); | ||
|
||
modelBuilder.Entity("UsefulTime.Api.Models.VideoMetadatas.VideoMetadata", b => | ||
{ | ||
b.Property<Guid>("Id") | ||
.ValueGeneratedOnAdd() | ||
.HasColumnType("uniqueidentifier"); | ||
b.Property<string>("BlobPath") | ||
.IsRequired() | ||
.HasColumnType("nvarchar(max)"); | ||
b.Property<DateTimeOffset>("CreatedDate") | ||
.HasColumnType("datetimeoffset"); | ||
b.Property<string>("Description") | ||
.IsRequired() | ||
.HasColumnType("nvarchar(max)"); | ||
b.Property<string>("Thubnail") | ||
.IsRequired() | ||
.HasColumnType("nvarchar(max)"); | ||
b.Property<string>("Title") | ||
.IsRequired() | ||
.HasColumnType("nvarchar(max)"); | ||
b.Property<DateTimeOffset>("UpdatedDate") | ||
.HasColumnType("datetimeoffset"); | ||
b.HasKey("Id"); | ||
b.ToTable("VideoMetadatas"); | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
//================================================= | ||
//Copyright (c) Coalition of Good-Hearted Engineers | ||
//Free To Use To Find Comfort and Pease | ||
//================================================= | ||
namespace UsefulTime.Api.Models.VideoMetadatas | ||
{ | ||
public class VideoMetadata | ||
{ | ||
public Guid Id { get; set; } | ||
public string Title { get; set; } | ||
Check warning on line 10 in UsefulTime.Api/Models/VideoMetadatas/VideoMetadata.cs GitHub Actions / build
|
||
public string Description { get; set; } | ||
Check warning on line 11 in UsefulTime.Api/Models/VideoMetadatas/VideoMetadata.cs GitHub Actions / build
|
||
public string BlobPath { get; set; } | ||
Check warning on line 12 in UsefulTime.Api/Models/VideoMetadatas/VideoMetadata.cs GitHub Actions / build
|
||
public string Thubnail { get; set; } | ||
public DateTimeOffset CreatedDate { get; set; } | ||
public DateTimeOffset UpdatedDate { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,35 @@ | ||
var builder = WebApplication.CreateBuilder(args); | ||
//================================================= | ||
//Copyright (c) Coalition of Good-Hearted Engineers | ||
//Free To Use To Find Comfort and Pease | ||
//================================================= | ||
using UsefulTime.Api.Brokers.Storages; | ||
|
||
// Add services to the container. | ||
public class Program | ||
{ | ||
private static void Main(string[] args) | ||
{ | ||
var builder = WebApplication.CreateBuilder(args); | ||
|
||
builder.Services.AddControllers(); | ||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle | ||
builder.Services.AddEndpointsApiExplorer(); | ||
builder.Services.AddSwaggerGen(); | ||
builder.Services.AddControllers(); | ||
|
||
var app = builder.Build(); | ||
builder.Services.AddEndpointsApiExplorer(); | ||
builder.Services.AddSwaggerGen(); | ||
builder.Services.AddTransient<IStorageBroker, StorageBroker>(); | ||
|
||
// Configure the HTTP request pipeline. | ||
if (app.Environment.IsDevelopment()) | ||
{ | ||
app.UseSwagger(); | ||
app.UseSwaggerUI(); | ||
} | ||
var app = builder.Build(); | ||
|
||
if (app.Environment.IsDevelopment()) | ||
{ | ||
app.UseSwagger(); | ||
app.UseSwaggerUI(); | ||
} | ||
|
||
app.UseHttpsRedirection(); | ||
app.UseHttpsRedirection(); | ||
|
||
app.UseAuthorization(); | ||
app.UseAuthorization(); | ||
|
||
app.MapControllers(); | ||
app.MapControllers(); | ||
|
||
app.Run(); | ||
app.Run(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters