Staged
This commit is contained in:
@@ -38,6 +38,9 @@ namespace Musify.Application.Configuration
|
|||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public string PresetLargePicture { get; set; } = "PresetLargePicture.webp";
|
public string PresetLargePicture { get; set; } = "PresetLargePicture.webp";
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public string Audios { get; set; } = "Audios";
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TrackPicturesSizes
|
public class TrackPicturesSizes
|
||||||
|
|||||||
@@ -4,6 +4,6 @@ namespace Musify.Application.Contracts.Infrastructure
|
|||||||
{
|
{
|
||||||
public interface IAudioTranscoder
|
public interface IAudioTranscoder
|
||||||
{
|
{
|
||||||
Task<Result> TranscodeToDash(Stream audioStream, string folderName, CancellationToken cancellationToken);
|
Task<Result> TranscodeToDashAsync(Stream audioStream, string destinationPath, TimeSpan timeOut, CancellationToken cancellationToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
namespace Musify.Application.Events
|
|
||||||
{
|
|
||||||
public record ProcessTrackEvent();
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
namespace Musify.Application.Events
|
||||||
|
{
|
||||||
|
public record TranscodeAudioFromTrackEvent(
|
||||||
|
string SourceBucketName,
|
||||||
|
string SourceKeyName,
|
||||||
|
string DestinationBucketName,
|
||||||
|
string DestinationKeyName);
|
||||||
|
}
|
||||||
@@ -52,19 +52,37 @@ namespace Musify.Application.Tracks.Handler
|
|||||||
return Result.Error($"Failed to publish resize picture event for Track with id {track.Id}.");
|
return Result.Error($"Failed to publish resize picture event for Track with id {track.Id}.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var audioKeyName = Path.Combine(trackConfiguration.Routes.Audios, $"{Guid.NewGuid() }.{request.Audio.FileType}");
|
||||||
|
var audioUploadResult = await UploadFile(request.Audio, audioKeyName, cancellationToken);
|
||||||
|
if (!audioUploadResult.IsSuccess)
|
||||||
|
{
|
||||||
|
logger.LogError("Failed to upload audio for track {TrackTitle}", request.Title);
|
||||||
|
return Result.Error($"Failed to upload audio for track {request.Title}");
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await PublishTranscodeEvent(track.Id, audioUploadResult, cancellationToken);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
logger.LogError(exception, "Failed to publish transcode audio event for Track with id={TrackId}.", track.Id);
|
||||||
|
return Result.Error($"An error occurred while processing the audio for Track with id {track.Id}.");
|
||||||
|
}
|
||||||
|
|
||||||
await database.Tracks.AddAsync(track, cancellationToken);
|
await database.Tracks.AddAsync(track, cancellationToken);
|
||||||
await database.SaveChangesAsync(cancellationToken);
|
await database.SaveChangesAsync(cancellationToken);
|
||||||
|
|
||||||
return Result.Success();
|
return Result.Success();
|
||||||
}
|
}
|
||||||
|
|
||||||
async Task<Result<string>> UploadFile(IFileData fileData, string originalPictureKeyName, CancellationToken cancellationToken)
|
async Task<Result<string>> UploadFile(IFileData fileData, string keyName, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var uploadFile = await storageHandler.UploadFileAsync(
|
var uploadFile = await storageHandler.UploadFileAsync(
|
||||||
fileData.FileStream,
|
fileData.FileStream,
|
||||||
fileData.ContentType,
|
fileData.ContentType,
|
||||||
storageConfiguration.BucketName,
|
storageConfiguration.BucketName,
|
||||||
originalPictureKeyName,
|
keyName,
|
||||||
cancellationToken);
|
cancellationToken);
|
||||||
|
|
||||||
return uploadFile;
|
return uploadFile;
|
||||||
@@ -96,5 +114,18 @@ namespace Musify.Application.Tracks.Handler
|
|||||||
trackConfiguration.PicturesSizes.LargePictureWidth,
|
trackConfiguration.PicturesSizes.LargePictureWidth,
|
||||||
trackConfiguration.PicturesSizes.LargePictureHeight), cancellationToken);
|
trackConfiguration.PicturesSizes.LargePictureHeight), cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async Task PublishTranscodeEvent(Guid trackId, string audioKeyName, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var destinationAudioKeyName = Path.Combine(
|
||||||
|
trackConfiguration.Routes.Audios,
|
||||||
|
trackId.ToString());
|
||||||
|
|
||||||
|
await eventBus.PublishAsync(new TranscodeAudioFromTrackEvent(
|
||||||
|
storageConfiguration.BucketName,
|
||||||
|
audioKeyName,
|
||||||
|
storageConfiguration.BucketName,
|
||||||
|
destinationAudioKeyName), cancellationToken);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,31 +1,28 @@
|
|||||||
using Ardalis.Result;
|
using Ardalis.Result;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Musify.Application.Contracts.Infrastructure;
|
using Musify.Application.Contracts.Infrastructure;
|
||||||
using Musify.Infrastructure.Configuration;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
|
||||||
namespace Musify.Infrastructure.Audio
|
namespace Musify.Infrastructure.Audio
|
||||||
{
|
{
|
||||||
public class AudioTranscoder(ILogger<AudioTranscoder> logger, AudioTranscoderConfiguration transcoderConfiguration)
|
public class AudioTranscoder(ILogger<AudioTranscoder> logger)
|
||||||
: IAudioTranscoder
|
: IAudioTranscoder
|
||||||
{
|
{
|
||||||
const string FfmpegProcessName = "ffmpeg";
|
const string FfmpegProcessName = "ffmpeg";
|
||||||
|
|
||||||
public async Task<Result> TranscodeToDash(Stream audioStream, string folderName, CancellationToken cancellationToken)
|
public async Task<Result> TranscodeToDashAsync(Stream audioStream, string destinationPath, TimeSpan timeOut, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var workingDirectory = Path.Combine(transcoderConfiguration.Routes.WorkingDirectory, folderName);
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(workingDirectory);
|
Directory.CreateDirectory(destinationPath);
|
||||||
|
|
||||||
using var process = new Process
|
using var process = new Process
|
||||||
{
|
{
|
||||||
StartInfo = new ProcessStartInfo
|
StartInfo = new ProcessStartInfo
|
||||||
{
|
{
|
||||||
FileName = FfmpegProcessName,
|
FileName = FfmpegProcessName,
|
||||||
WorkingDirectory = workingDirectory,
|
WorkingDirectory = destinationPath,
|
||||||
Arguments = BuildDashArguments(workingDirectory),
|
Arguments = BuildDashArguments(destinationPath),
|
||||||
RedirectStandardInput = true,
|
RedirectStandardInput = true,
|
||||||
RedirectStandardOutput = true,
|
RedirectStandardOutput = true,
|
||||||
RedirectStandardError = true,
|
RedirectStandardError = true,
|
||||||
@@ -44,7 +41,7 @@ namespace Musify.Infrastructure.Audio
|
|||||||
var outputTask = process.StandardOutput.ReadToEndAsync(cancellationToken);
|
var outputTask = process.StandardOutput.ReadToEndAsync(cancellationToken);
|
||||||
|
|
||||||
using var linkedCancellationTokens = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
|
using var linkedCancellationTokens = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
|
||||||
linkedCancellationTokens.CancelAfter(transcoderConfiguration.TranscodingTimeout);
|
linkedCancellationTokens.CancelAfter(timeOut);
|
||||||
await process.WaitForExitAsync(linkedCancellationTokens.Token);
|
await process.WaitForExitAsync(linkedCancellationTokens.Token);
|
||||||
|
|
||||||
var standardError = await errorTask;
|
var standardError = await errorTask;
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
namespace Musify.Infrastructure.Messaging.Activities.Arguments
|
||||||
|
{
|
||||||
|
public record DownloadFileFromBucketArguments(
|
||||||
|
string BucketName,
|
||||||
|
string KeyName,
|
||||||
|
string DestinationPath);
|
||||||
|
}
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
namespace Musify.Infrastructure.Messaging.Activities.Arguments
|
namespace Musify.Infrastructure.Messaging.Activities.Arguments
|
||||||
{
|
{
|
||||||
public record RemoveFileArguments(
|
public record RemoveFileFromBucketArguments(
|
||||||
string BucketName,
|
string BucketName,
|
||||||
string KeyName);
|
string KeyName);
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
namespace Musify.Infrastructure.Messaging.Activities.Arguments
|
||||||
|
{
|
||||||
|
public record TranscodeDashAudioArguments(string SourceFilePath, string DestinationFolderName);
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
namespace Musify.Infrastructure.Messaging.Activities.Arguments
|
||||||
|
{
|
||||||
|
public record TransferFilesToBucketArguments(
|
||||||
|
string FolderPath,
|
||||||
|
string DestinationBucketName,
|
||||||
|
string DestinationKeyName);
|
||||||
|
}
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
using MassTransit;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using Musify.Application.Contracts.Infrastructure;
|
|
||||||
using Musify.Infrastructure.Messaging.Activities.Arguments;
|
|
||||||
|
|
||||||
namespace Musify.Infrastructure.Messaging.Activities
|
|
||||||
{
|
|
||||||
public class CopyFilesActivity(IStorageHandler storageHandler, ILogger<CopyFilesActivity> logger)
|
|
||||||
: IExecuteActivity<CopyFileArguments[]>
|
|
||||||
{
|
|
||||||
public async Task<ExecutionResult> Execute(ExecuteContext<CopyFileArguments[]> executeContext)
|
|
||||||
{
|
|
||||||
foreach (var file in executeContext.Arguments)
|
|
||||||
{
|
|
||||||
var copyFileResult = await storageHandler.CopyFileAsync(
|
|
||||||
file.SourceBucketName,
|
|
||||||
file.SourceKeyName,
|
|
||||||
file.DestinationBucketName,
|
|
||||||
file.SourceKeyName,
|
|
||||||
executeContext.CancellationToken);
|
|
||||||
|
|
||||||
if (!copyFileResult.IsSuccess)
|
|
||||||
{
|
|
||||||
string errorMessage = string.Join("; ", copyFileResult.Errors);
|
|
||||||
logger.LogError(
|
|
||||||
"Failed to copy file from {SourceBucket}/{SourceKey} to {DestinationBucket}/{DestinationKey}. Error: {ErrorMessage}",
|
|
||||||
file.SourceBucketName,
|
|
||||||
file.SourceKeyName,
|
|
||||||
file.DestinationBucketName,
|
|
||||||
file.DestinationKeyName,
|
|
||||||
errorMessage);
|
|
||||||
throw new Exception(errorMessage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return executeContext.Completed();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
using MassTransit;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Musify.Application.Contracts.Infrastructure;
|
||||||
|
using Musify.Infrastructure.Messaging.Activities.Arguments;
|
||||||
|
using Musify.Infrastructure.Messaging.Activities.Logs;
|
||||||
|
|
||||||
|
namespace Musify.Infrastructure.Messaging.Activities
|
||||||
|
{
|
||||||
|
public class DownloadFileFromBucketActivity(IStorageHandler storageHandler, ILogger<DownloadFileFromBucketActivity> logger)
|
||||||
|
: IExecuteActivity<DownloadFileFromBucketArguments>
|
||||||
|
{
|
||||||
|
public const string ExecuteEndpointName = "Download-File-From-Bucket";
|
||||||
|
|
||||||
|
public async Task<ExecutionResult> Execute(ExecuteContext<DownloadFileFromBucketArguments> executeContext)
|
||||||
|
{
|
||||||
|
var getFile = await storageHandler.GetFileAsync(
|
||||||
|
executeContext.Arguments.BucketName,
|
||||||
|
executeContext.Arguments.KeyName,
|
||||||
|
executeContext.CancellationToken);
|
||||||
|
|
||||||
|
if (!getFile.IsSuccess)
|
||||||
|
{
|
||||||
|
var error = string.Join("; ", getFile.Errors);
|
||||||
|
logger.LogError("Failed to download file from bucket. Bucket: {BucketName}, Key: {KeyName}",
|
||||||
|
executeContext.Arguments.BucketName,
|
||||||
|
executeContext.Arguments.KeyName);
|
||||||
|
throw new Exception(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
using var fileStream = getFile.Value;
|
||||||
|
if (fileStream.CanSeek)
|
||||||
|
fileStream.Position = 0;
|
||||||
|
|
||||||
|
var fileName = Path.GetFileName(executeContext.Arguments.KeyName);
|
||||||
|
using var destinationStream = File.Create($"D:\\tempsFilesDev\\{fileName}");
|
||||||
|
await fileStream.CopyToAsync(destinationStream, executeContext.CancellationToken);
|
||||||
|
|
||||||
|
return executeContext.Completed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+5
-5
@@ -6,15 +6,15 @@ using Musify.Infrastructure.Messaging.Activities.Arguments;
|
|||||||
|
|
||||||
namespace Musify.Infrastructure.Messaging.Activities
|
namespace Musify.Infrastructure.Messaging.Activities
|
||||||
{
|
{
|
||||||
public class RemoveFilesActivity(
|
public class RemoveFileFromBucketActivity(
|
||||||
IStorageHandler storageHandler,
|
IStorageHandler storageHandler,
|
||||||
ILogger<RemoveFilesActivity> logger,
|
ILogger<RemoveFileFromBucketActivity> logger,
|
||||||
IProcessTrackingStore processTrackingStore)
|
IProcessTrackingStore processTrackingStore)
|
||||||
: IExecuteActivity<RemoveFileArguments>
|
: IExecuteActivity<RemoveFileFromBucketArguments>
|
||||||
{
|
{
|
||||||
public const string ExecuteEndpointName = "Remove-File";
|
public const string ExecuteEndpointName = "Remove-File";
|
||||||
|
|
||||||
public async Task<ExecutionResult> Execute(ExecuteContext<RemoveFileArguments> executeContext)
|
public async Task<ExecutionResult> Execute(ExecuteContext<RemoveFileFromBucketArguments> executeContext)
|
||||||
{
|
{
|
||||||
var processId = await processTrackingStore.GetOrCreateProcessAsync(
|
var processId = await processTrackingStore.GetOrCreateProcessAsync(
|
||||||
"RoutingSlip",
|
"RoutingSlip",
|
||||||
@@ -25,7 +25,7 @@ namespace Musify.Infrastructure.Messaging.Activities
|
|||||||
|
|
||||||
var stepId = await processTrackingStore.StartStepAsync(
|
var stepId = await processTrackingStore.StartStepAsync(
|
||||||
processId,
|
processId,
|
||||||
nameof(RemoveFilesActivity),
|
nameof(RemoveFileFromBucketActivity),
|
||||||
ProcessStepComponentType.Activity,
|
ProcessStepComponentType.Activity,
|
||||||
0,
|
0,
|
||||||
executeContext.CancellationToken);
|
executeContext.CancellationToken);
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
using MassTransit;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Musify.Application.Contracts.Infrastructure;
|
||||||
|
using Musify.Infrastructure.Configuration;
|
||||||
|
using Musify.Infrastructure.Messaging.Activities.Arguments;
|
||||||
|
using Musify.Infrastructure.Messaging.Activities.Logs;
|
||||||
|
|
||||||
|
namespace Musify.Infrastructure.Messaging.Activities
|
||||||
|
{
|
||||||
|
public class TranscodeDashAudioActivity(IAudioTranscoder audioTranscoder, ILogger<TranscodeDashAudioActivity> logger,
|
||||||
|
AudioTranscoderConfiguration audioTranscoderConfiguration)
|
||||||
|
: IExecuteActivity<TranscodeDashAudioArguments>
|
||||||
|
{
|
||||||
|
public const string ExecuteEndpointName = "Transcode-Dash-Audio";
|
||||||
|
|
||||||
|
public async Task<ExecutionResult> Execute(ExecuteContext<TranscodeDashAudioArguments> executeContext)
|
||||||
|
{
|
||||||
|
var workingDirectory = Path.Combine(
|
||||||
|
audioTranscoderConfiguration.Routes.WorkingDirectory,
|
||||||
|
executeContext.Arguments.DestinationFolderName);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await using var fileStream = File.OpenRead(executeContext.Arguments.SourceFilePath);
|
||||||
|
|
||||||
|
var result = await audioTranscoder.TranscodeToDashAsync(
|
||||||
|
fileStream,
|
||||||
|
executeContext.Arguments.DestinationFolderName,
|
||||||
|
audioTranscoderConfiguration.TranscodingTimeout,
|
||||||
|
executeContext.CancellationToken);
|
||||||
|
|
||||||
|
if (!result.IsSuccess)
|
||||||
|
{
|
||||||
|
var errors = string.Join("; ", result.Errors);
|
||||||
|
logger.LogError("transcoding failed for file {SourceFilePath}. Error: {ErrorMessage}",
|
||||||
|
executeContext.Arguments.SourceFilePath, errors);
|
||||||
|
throw new Exception(errors);
|
||||||
|
}
|
||||||
|
|
||||||
|
return executeContext.Completed();
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
logger.LogError(exception, "Error during transcoding activity.");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
using MassTransit;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Musify.Application.Contracts.Infrastructure;
|
||||||
|
using Musify.Infrastructure.Messaging.Activities.Arguments;
|
||||||
|
|
||||||
|
namespace Musify.Infrastructure.Messaging.Activities
|
||||||
|
{
|
||||||
|
public class TransferFilesToBucket(IStorageHandler storageHandler, ILogger<TransferFilesToBucket> logger)
|
||||||
|
: IExecuteActivity<TransferFilesToBucketArguments>
|
||||||
|
{
|
||||||
|
public const string ExecuteEndpointName = "Transfer-Files-To-Bucket";
|
||||||
|
|
||||||
|
public async Task<ExecutionResult> Execute(ExecuteContext<TransferFilesToBucketArguments> executeContext)
|
||||||
|
{
|
||||||
|
var transferFilesResult = await storageHandler.TransferFilesAsync(
|
||||||
|
executeContext.Arguments.FolderPath,
|
||||||
|
executeContext.Arguments.DestinationBucketName,
|
||||||
|
executeContext.Arguments.DestinationKeyName,
|
||||||
|
executeContext.CancellationToken);
|
||||||
|
|
||||||
|
if (!transferFilesResult.IsSuccess)
|
||||||
|
{
|
||||||
|
var errors = string.Join("; ", transferFilesResult.Errors);
|
||||||
|
logger.LogError($"An error occurred while transferring files to bucket: {errors}");
|
||||||
|
throw new Exception(errors);
|
||||||
|
}
|
||||||
|
|
||||||
|
return executeContext.Completed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,8 +16,8 @@ namespace Musify.Infrastructure.Messaging.Consumers
|
|||||||
|
|
||||||
routingSlipBuilder.AddActivity(
|
routingSlipBuilder.AddActivity(
|
||||||
"RemoveFile",
|
"RemoveFile",
|
||||||
BuildExecuteUri(RemoveFilesActivity.ExecuteEndpointName),
|
BuildExecuteUri(RemoveFileFromBucketActivity.ExecuteEndpointName),
|
||||||
new RemoveFileArguments(
|
new RemoveFileFromBucketArguments(
|
||||||
consumeContext.Message.BucketName,
|
consumeContext.Message.BucketName,
|
||||||
consumeContext.Message.KeyName));
|
consumeContext.Message.KeyName));
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
using MassTransit;
|
||||||
|
using Musify.Application.Events;
|
||||||
|
using Musify.Infrastructure.Configuration;
|
||||||
|
using Musify.Infrastructure.Messaging.Activities;
|
||||||
|
using Musify.Infrastructure.Messaging.Activities.Arguments;
|
||||||
|
|
||||||
|
namespace Musify.Infrastructure.Messaging.Consumers
|
||||||
|
{
|
||||||
|
public class TranscodeAudioFromTrackConsumer(IBus bus, AudioTranscoderConfiguration audioTranscoderConfiguration)
|
||||||
|
: IConsumer<TranscodeAudioFromTrackEvent>
|
||||||
|
{
|
||||||
|
public const string QueueName = "Transcode-Audio-From-Track";
|
||||||
|
|
||||||
|
public async Task Consume(ConsumeContext<TranscodeAudioFromTrackEvent> consumeContext)
|
||||||
|
{
|
||||||
|
var routingSlipBuilder = new RoutingSlipBuilder(NewId.NextGuid());
|
||||||
|
|
||||||
|
var folderName = Guid.NewGuid().ToString();
|
||||||
|
var workingDirectory = Path.Combine("D:\\tempsFilesDev\\");
|
||||||
|
|
||||||
|
routingSlipBuilder.AddActivity(
|
||||||
|
"DownloadFile",
|
||||||
|
BuildExecuteUri(DownloadFileFromBucketActivity.ExecuteEndpointName),
|
||||||
|
new DownloadFileFromBucketArguments(
|
||||||
|
consumeContext.Message.SourceBucketName,
|
||||||
|
consumeContext.Message.SourceKeyName,
|
||||||
|
workingDirectory)
|
||||||
|
);
|
||||||
|
var fileName = Path.GetFileName(consumeContext.Message.SourceKeyName);
|
||||||
|
|
||||||
|
routingSlipBuilder.AddActivity(
|
||||||
|
"TranscodeAudio",
|
||||||
|
BuildExecuteUri(TranscodeDashAudioActivity.ExecuteEndpointName),
|
||||||
|
new TranscodeDashAudioArguments(
|
||||||
|
$"D:\\tempsFilesDev\\{fileName}",
|
||||||
|
"D:\\tempsFilesDev\\")
|
||||||
|
);
|
||||||
|
|
||||||
|
routingSlipBuilder.AddActivity(
|
||||||
|
"UploadFile",
|
||||||
|
BuildExecuteUri(TransferFilesToBucket.ExecuteEndpointName),
|
||||||
|
new TransferFilesToBucketArguments(
|
||||||
|
workingDirectory,
|
||||||
|
consumeContext.Message.DestinationBucketName,
|
||||||
|
consumeContext.Message.DestinationKeyName)
|
||||||
|
);
|
||||||
|
|
||||||
|
var routingSlip = routingSlipBuilder.Build();
|
||||||
|
await bus.Execute(routingSlip);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Uri BuildExecuteUri(string endpointName) => new($"queue:{endpointName}_execute");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -43,8 +43,8 @@ namespace Musify.Infrastructure.Messaging.Consumers
|
|||||||
|
|
||||||
routingSlipBuilder.AddActivity(
|
routingSlipBuilder.AddActivity(
|
||||||
"DeleteOriginal",
|
"DeleteOriginal",
|
||||||
BuildExecuteUri(RemoveFilesActivity.ExecuteEndpointName),
|
BuildExecuteUri(RemoveFileFromBucketActivity.ExecuteEndpointName),
|
||||||
new RemoveFileArguments(
|
new RemoveFileFromBucketArguments(
|
||||||
consumeContext.Message.BucketName,
|
consumeContext.Message.BucketName,
|
||||||
consumeContext.Message.OriginalPictureKeyName)
|
consumeContext.Message.OriginalPictureKeyName)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -43,8 +43,8 @@ namespace Musify.Infrastructure.Messaging.Consumers
|
|||||||
|
|
||||||
routingSlipBuilder.AddActivity(
|
routingSlipBuilder.AddActivity(
|
||||||
"DeleteOriginal",
|
"DeleteOriginal",
|
||||||
BuildExecuteUri(RemoveFilesActivity.ExecuteEndpointName),
|
BuildExecuteUri(RemoveFileFromBucketActivity.ExecuteEndpointName),
|
||||||
new RemoveFileArguments(
|
new RemoveFileFromBucketArguments(
|
||||||
consumeContext.Message.BucketName,
|
consumeContext.Message.BucketName,
|
||||||
consumeContext.Message.OriginalPictureKeyName)
|
consumeContext.Message.OriginalPictureKeyName)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Microsoft.Extensions.DependencyInjection;
|
|||||||
using Musify.Infrastructure.Configuration;
|
using Musify.Infrastructure.Configuration;
|
||||||
using Musify.Infrastructure.Messaging.Activities;
|
using Musify.Infrastructure.Messaging.Activities;
|
||||||
using Musify.Infrastructure.Messaging.Activities.Arguments;
|
using Musify.Infrastructure.Messaging.Activities.Arguments;
|
||||||
|
using Musify.Infrastructure.Messaging.Activities.Logs;
|
||||||
using Musify.Infrastructure.Messaging.Consumers;
|
using Musify.Infrastructure.Messaging.Consumers;
|
||||||
using Musify.Infrastructure.Messaging.Filters;
|
using Musify.Infrastructure.Messaging.Filters;
|
||||||
|
|
||||||
@@ -29,9 +30,15 @@ namespace Musify.Infrastructure.Messaging
|
|||||||
{
|
{
|
||||||
options.AddConsumer<UpdatePlayListPictureConsumer>();
|
options.AddConsumer<UpdatePlayListPictureConsumer>();
|
||||||
options.AddConsumer<RemoveFileConsumer>();
|
options.AddConsumer<RemoveFileConsumer>();
|
||||||
|
options.AddConsumer<TranscodeAudioFromTrackConsumer>();
|
||||||
|
options.AddConsumer<UpdateTrackPictureConsumer>();
|
||||||
|
|
||||||
options.AddExecuteActivity<ResizePictureActivity, ResizePictureArgument>();
|
options.AddExecuteActivity<ResizePictureActivity, ResizePictureArgument>();
|
||||||
options.AddExecuteActivity<RemoveFilesActivity, RemoveFileArguments>();
|
options.AddExecuteActivity<RemoveFileFromBucketActivity, RemoveFileFromBucketArguments>();
|
||||||
options.AddExecuteActivity<UpdatePlayListPictureActivity, UpdatePlayListPictureArguments>();
|
options.AddExecuteActivity<UpdatePlayListPictureActivity, UpdatePlayListPictureArguments>();
|
||||||
|
options.AddExecuteActivity<UpdateTrackPictureActivity, UpdateTrackPictureArguments>();
|
||||||
|
options.AddExecuteActivity<DownloadFileFromBucketActivity, DownloadFileFromBucketArguments>();
|
||||||
|
options.AddExecuteActivity<TranscodeDashAudioActivity, TranscodeDashAudioArguments>();
|
||||||
|
|
||||||
options.UsingRabbitMq((busRegistrationContext, busFactoryConfigurator) =>
|
options.UsingRabbitMq((busRegistrationContext, busFactoryConfigurator) =>
|
||||||
{
|
{
|
||||||
@@ -51,20 +58,45 @@ namespace Musify.Infrastructure.Messaging
|
|||||||
endpointConfigurator.ConfigureConsumer<RemoveFileConsumer>(busRegistrationContext);
|
endpointConfigurator.ConfigureConsumer<RemoveFileConsumer>(busRegistrationContext);
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
busFactoryConfigurator.ReceiveEndpoint(TranscodeAudioFromTrackConsumer.QueueName, endpointConfigurator =>
|
||||||
|
{
|
||||||
|
endpointConfigurator.ConfigureConsumer<TranscodeAudioFromTrackConsumer>(busRegistrationContext);
|
||||||
|
} );
|
||||||
|
|
||||||
|
busFactoryConfigurator.ReceiveEndpoint(UpdateTrackPictureConsumer.QueueName, endpointConfigurator =>
|
||||||
|
{
|
||||||
|
endpointConfigurator.ConfigureConsumer<UpdateTrackPictureConsumer>(busRegistrationContext);
|
||||||
|
} );
|
||||||
|
|
||||||
ConfigureExecuteActivityEndpoint<ResizePictureActivity, ResizePictureArgument>(
|
ConfigureExecuteActivityEndpoint<ResizePictureActivity, ResizePictureArgument>(
|
||||||
busFactoryConfigurator,
|
busFactoryConfigurator,
|
||||||
busRegistrationContext,
|
busRegistrationContext,
|
||||||
ResizePictureActivity.ExecuteEndpointName);
|
ResizePictureActivity.ExecuteEndpointName);
|
||||||
|
|
||||||
ConfigureExecuteActivityEndpoint<RemoveFilesActivity, RemoveFileArguments>(
|
ConfigureExecuteActivityEndpoint<RemoveFileFromBucketActivity, RemoveFileFromBucketArguments>(
|
||||||
busFactoryConfigurator,
|
busFactoryConfigurator,
|
||||||
busRegistrationContext,
|
busRegistrationContext,
|
||||||
RemoveFilesActivity.ExecuteEndpointName);
|
RemoveFileFromBucketActivity.ExecuteEndpointName);
|
||||||
|
|
||||||
ConfigureExecuteActivityEndpoint<UpdatePlayListPictureActivity, UpdatePlayListPictureArguments>(
|
ConfigureExecuteActivityEndpoint<UpdatePlayListPictureActivity, UpdatePlayListPictureArguments>(
|
||||||
busFactoryConfigurator,
|
busFactoryConfigurator,
|
||||||
busRegistrationContext,
|
busRegistrationContext,
|
||||||
UpdatePlayListPictureActivity.ExecuteEndpointName);
|
UpdatePlayListPictureActivity.ExecuteEndpointName);
|
||||||
|
|
||||||
|
ConfigureExecuteActivityEndpoint<UpdateTrackPictureActivity, UpdateTrackPictureArguments>(
|
||||||
|
busFactoryConfigurator,
|
||||||
|
busRegistrationContext,
|
||||||
|
UpdateTrackPictureActivity.ExecuteEndpointName);
|
||||||
|
|
||||||
|
ConfigureExecuteActivityEndpoint<DownloadFileFromBucketActivity, DownloadFileFromBucketArguments>(
|
||||||
|
busFactoryConfigurator,
|
||||||
|
busRegistrationContext,
|
||||||
|
DownloadFileFromBucketActivity.ExecuteEndpointName);
|
||||||
|
|
||||||
|
ConfigureExecuteActivityEndpoint<TranscodeDashAudioActivity, TranscodeDashAudioArguments>(
|
||||||
|
busFactoryConfigurator,
|
||||||
|
busRegistrationContext,
|
||||||
|
TranscodeDashAudioActivity.ExecuteEndpointName);
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
@@ -94,5 +126,24 @@ namespace Musify.Infrastructure.Messaging
|
|||||||
endpointConfigurator.ExecuteActivityHost<TActivity, TArguments>(busRegistrationContext);
|
endpointConfigurator.ExecuteActivityHost<TActivity, TArguments>(busRegistrationContext);
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ConfigureActivityEndpoints<TActivity, TArguments, TLog>(
|
||||||
|
IRabbitMqBusFactoryConfigurator busFactoryConfigurator,
|
||||||
|
IBusRegistrationContext busRegistrationContext,
|
||||||
|
string endpointName)
|
||||||
|
where TActivity : class, IActivity<TArguments, TLog>
|
||||||
|
where TArguments : class
|
||||||
|
where TLog : class
|
||||||
|
{
|
||||||
|
busFactoryConfigurator.ReceiveEndpoint($"{endpointName}_execute", endpointConfigurator =>
|
||||||
|
{
|
||||||
|
endpointConfigurator.ExecuteActivityHost<TActivity, TArguments>(busRegistrationContext);
|
||||||
|
} );
|
||||||
|
|
||||||
|
busFactoryConfigurator.ReceiveEndpoint($"{endpointName}_compensate", endpointConfigurator =>
|
||||||
|
{
|
||||||
|
endpointConfigurator.CompensateActivityHost<TActivity, TLog>(busRegistrationContext);
|
||||||
|
} );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+382
@@ -0,0 +1,382 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Musify.Infrastructure.Persistence;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Musify.Infrastructure.Persistence.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(Database))]
|
||||||
|
[Migration("20260322023145_FirstMigration")]
|
||||||
|
partial class FirstMigration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "10.0.5")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||||
|
|
||||||
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("Musify.Domain.Entities.PlayList", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedDate")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("Description")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(254)
|
||||||
|
.HasColumnType("character varying(254)");
|
||||||
|
|
||||||
|
b.Property<string>("LargePictureKeyName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<string>("MediumPictureKeyName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnType("character varying(50)");
|
||||||
|
|
||||||
|
b.Property<string>("NormalizedName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnType("character varying(50)");
|
||||||
|
|
||||||
|
b.Property<string>("SmallPictureKeyName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdatedDate")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<Guid>("UserId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
|
b.ToTable("PlayLists");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Musify.Domain.Entities.PlayListHasTrack", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<DateTime>("AddedAt")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<Guid>("PlayListId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<int>("Position")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<Guid>("TrackId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("PlayListId");
|
||||||
|
|
||||||
|
b.HasIndex("TrackId");
|
||||||
|
|
||||||
|
b.ToTable("PlayListHasTrack");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Musify.Domain.Entities.ProcessExecution", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<Guid?>("ConversationId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<Guid?>("CorrelationId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<string>("ErrorMessage")
|
||||||
|
.HasMaxLength(2048)
|
||||||
|
.HasColumnType("character varying(2048)");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("FinishedDateTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<Guid?>("MessageId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<string>("ProcessName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("character varying(256)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("StartedDateTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<int>("Status")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CorrelationId", "ProcessName");
|
||||||
|
|
||||||
|
b.ToTable("ProcessExecution");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Musify.Domain.Entities.ProcessStepExecution", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<int>("Attempt")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("ComponentType")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("ErrorMessage")
|
||||||
|
.HasMaxLength(2048)
|
||||||
|
.HasColumnType("character varying(2048)");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("FinishedDateTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<Guid>("ProcessExecutionId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<DateTime>("StartedDateTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<int>("Status")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("StepName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("character varying(256)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ProcessExecutionId", "StepName");
|
||||||
|
|
||||||
|
b.ToTable("ProcessStepExecution");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Musify.Domain.Entities.Track", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedDate")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("LargePictureKeyName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<string>("MediumPictureKeyName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<string>("NormalizedTitle")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnType("character varying(50)");
|
||||||
|
|
||||||
|
b.Property<string>("SmallPictureKeyName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<string>("Title")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnType("character varying(50)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdatedDate")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Tracks");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Musify.Domain.Entities.Upload", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<string>("BucketName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("ContentType")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("KeyName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int>("State")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Upload");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Musify.Domain.Entities.User", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdatedAt")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("User");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Musify.Domain.Entities.UserHasTrack", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<Guid>("TrackId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<Guid>("UserId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("TrackId");
|
||||||
|
|
||||||
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
|
b.ToTable("UserHasTrack");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Musify.Domain.Entities.PlayList", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Musify.Domain.Entities.User", "User")
|
||||||
|
.WithMany("PlayLists")
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("User");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Musify.Domain.Entities.PlayListHasTrack", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Musify.Domain.Entities.PlayList", "PlayList")
|
||||||
|
.WithMany("PlayListTracks")
|
||||||
|
.HasForeignKey("PlayListId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("Musify.Domain.Entities.Track", "Track")
|
||||||
|
.WithMany("PlayListTracks")
|
||||||
|
.HasForeignKey("TrackId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("PlayList");
|
||||||
|
|
||||||
|
b.Navigation("Track");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Musify.Domain.Entities.ProcessStepExecution", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Musify.Domain.Entities.ProcessExecution", "ProcessExecution")
|
||||||
|
.WithMany("Steps")
|
||||||
|
.HasForeignKey("ProcessExecutionId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("ProcessExecution");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Musify.Domain.Entities.UserHasTrack", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Musify.Domain.Entities.Track", "Track")
|
||||||
|
.WithMany("UserTracks")
|
||||||
|
.HasForeignKey("TrackId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("Musify.Domain.Entities.User", "User")
|
||||||
|
.WithMany("UserTracks")
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Track");
|
||||||
|
|
||||||
|
b.Navigation("User");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Musify.Domain.Entities.PlayList", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("PlayListTracks");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Musify.Domain.Entities.ProcessExecution", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Steps");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Musify.Domain.Entities.Track", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("PlayListTracks");
|
||||||
|
|
||||||
|
b.Navigation("UserTracks");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Musify.Domain.Entities.User", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("PlayLists");
|
||||||
|
|
||||||
|
b.Navigation("UserTracks");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,247 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Musify.Infrastructure.Persistence.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class FirstMigration : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "ProcessExecution",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
CorrelationId = table.Column<Guid>(type: "uuid", nullable: true),
|
||||||
|
ConversationId = table.Column<Guid>(type: "uuid", nullable: true),
|
||||||
|
MessageId = table.Column<Guid>(type: "uuid", nullable: true),
|
||||||
|
ProcessName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
|
||||||
|
Status = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
StartedDateTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||||
|
FinishedDateTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||||
|
ErrorMessage = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_ProcessExecution", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Tracks",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
Title = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
|
||||||
|
NormalizedTitle = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
|
||||||
|
SmallPictureKeyName = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
|
||||||
|
MediumPictureKeyName = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
|
||||||
|
LargePictureKeyName = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
|
||||||
|
CreatedDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||||
|
UpdatedDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Tracks", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Upload",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
KeyName = table.Column<string>(type: "text", nullable: false),
|
||||||
|
BucketName = table.Column<string>(type: "text", nullable: false),
|
||||||
|
ContentType = table.Column<string>(type: "text", nullable: false),
|
||||||
|
CreatedTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||||
|
State = table.Column<int>(type: "integer", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Upload", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "User",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||||
|
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_User", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "ProcessStepExecution",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
ProcessExecutionId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
StepName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
|
||||||
|
ComponentType = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
Status = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
Attempt = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
StartedDateTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||||
|
FinishedDateTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||||
|
ErrorMessage = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_ProcessStepExecution", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_ProcessStepExecution_ProcessExecution_ProcessExecutionId",
|
||||||
|
column: x => x.ProcessExecutionId,
|
||||||
|
principalTable: "ProcessExecution",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "PlayLists",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
UserId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
Name = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
|
||||||
|
NormalizedName = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
|
||||||
|
Description = table.Column<string>(type: "character varying(254)", maxLength: 254, nullable: false),
|
||||||
|
SmallPictureKeyName = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
|
||||||
|
MediumPictureKeyName = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
|
||||||
|
LargePictureKeyName = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
|
||||||
|
CreatedDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||||
|
UpdatedDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_PlayLists", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_PlayLists_User_UserId",
|
||||||
|
column: x => x.UserId,
|
||||||
|
principalTable: "User",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "UserHasTrack",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
UserId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
TrackId = table.Column<Guid>(type: "uuid", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_UserHasTrack", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_UserHasTrack_Tracks_TrackId",
|
||||||
|
column: x => x.TrackId,
|
||||||
|
principalTable: "Tracks",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_UserHasTrack_User_UserId",
|
||||||
|
column: x => x.UserId,
|
||||||
|
principalTable: "User",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "PlayListHasTrack",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
PlayListId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
TrackId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
Position = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
AddedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_PlayListHasTrack", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_PlayListHasTrack_PlayLists_PlayListId",
|
||||||
|
column: x => x.PlayListId,
|
||||||
|
principalTable: "PlayLists",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_PlayListHasTrack_Tracks_TrackId",
|
||||||
|
column: x => x.TrackId,
|
||||||
|
principalTable: "Tracks",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_PlayListHasTrack_PlayListId",
|
||||||
|
table: "PlayListHasTrack",
|
||||||
|
column: "PlayListId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_PlayListHasTrack_TrackId",
|
||||||
|
table: "PlayListHasTrack",
|
||||||
|
column: "TrackId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_PlayLists_UserId",
|
||||||
|
table: "PlayLists",
|
||||||
|
column: "UserId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_ProcessExecution_CorrelationId_ProcessName",
|
||||||
|
table: "ProcessExecution",
|
||||||
|
columns: new[] { "CorrelationId", "ProcessName" });
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_ProcessStepExecution_ProcessExecutionId_StepName",
|
||||||
|
table: "ProcessStepExecution",
|
||||||
|
columns: new[] { "ProcessExecutionId", "StepName" });
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_UserHasTrack_TrackId",
|
||||||
|
table: "UserHasTrack",
|
||||||
|
column: "TrackId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_UserHasTrack_UserId",
|
||||||
|
table: "UserHasTrack",
|
||||||
|
column: "UserId");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "PlayListHasTrack");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "ProcessStepExecution");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Upload");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "UserHasTrack");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "PlayLists");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "ProcessExecution");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Tracks");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "User");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,379 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Musify.Infrastructure.Persistence;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Musify.Infrastructure.Persistence.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(Database))]
|
||||||
|
partial class DatabaseModelSnapshot : ModelSnapshot
|
||||||
|
{
|
||||||
|
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "10.0.5")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||||
|
|
||||||
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("Musify.Domain.Entities.PlayList", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedDate")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("Description")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(254)
|
||||||
|
.HasColumnType("character varying(254)");
|
||||||
|
|
||||||
|
b.Property<string>("LargePictureKeyName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<string>("MediumPictureKeyName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnType("character varying(50)");
|
||||||
|
|
||||||
|
b.Property<string>("NormalizedName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnType("character varying(50)");
|
||||||
|
|
||||||
|
b.Property<string>("SmallPictureKeyName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdatedDate")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<Guid>("UserId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
|
b.ToTable("PlayLists");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Musify.Domain.Entities.PlayListHasTrack", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<DateTime>("AddedAt")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<Guid>("PlayListId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<int>("Position")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<Guid>("TrackId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("PlayListId");
|
||||||
|
|
||||||
|
b.HasIndex("TrackId");
|
||||||
|
|
||||||
|
b.ToTable("PlayListHasTrack");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Musify.Domain.Entities.ProcessExecution", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<Guid?>("ConversationId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<Guid?>("CorrelationId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<string>("ErrorMessage")
|
||||||
|
.HasMaxLength(2048)
|
||||||
|
.HasColumnType("character varying(2048)");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("FinishedDateTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<Guid?>("MessageId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<string>("ProcessName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("character varying(256)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("StartedDateTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<int>("Status")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CorrelationId", "ProcessName");
|
||||||
|
|
||||||
|
b.ToTable("ProcessExecution");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Musify.Domain.Entities.ProcessStepExecution", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<int>("Attempt")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("ComponentType")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("ErrorMessage")
|
||||||
|
.HasMaxLength(2048)
|
||||||
|
.HasColumnType("character varying(2048)");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("FinishedDateTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<Guid>("ProcessExecutionId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<DateTime>("StartedDateTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<int>("Status")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("StepName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("character varying(256)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ProcessExecutionId", "StepName");
|
||||||
|
|
||||||
|
b.ToTable("ProcessStepExecution");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Musify.Domain.Entities.Track", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedDate")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("LargePictureKeyName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<string>("MediumPictureKeyName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<string>("NormalizedTitle")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnType("character varying(50)");
|
||||||
|
|
||||||
|
b.Property<string>("SmallPictureKeyName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<string>("Title")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnType("character varying(50)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdatedDate")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Tracks");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Musify.Domain.Entities.Upload", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<string>("BucketName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("ContentType")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("KeyName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int>("State")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Upload");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Musify.Domain.Entities.User", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdatedAt")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("User");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Musify.Domain.Entities.UserHasTrack", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<Guid>("TrackId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<Guid>("UserId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("TrackId");
|
||||||
|
|
||||||
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
|
b.ToTable("UserHasTrack");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Musify.Domain.Entities.PlayList", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Musify.Domain.Entities.User", "User")
|
||||||
|
.WithMany("PlayLists")
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("User");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Musify.Domain.Entities.PlayListHasTrack", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Musify.Domain.Entities.PlayList", "PlayList")
|
||||||
|
.WithMany("PlayListTracks")
|
||||||
|
.HasForeignKey("PlayListId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("Musify.Domain.Entities.Track", "Track")
|
||||||
|
.WithMany("PlayListTracks")
|
||||||
|
.HasForeignKey("TrackId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("PlayList");
|
||||||
|
|
||||||
|
b.Navigation("Track");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Musify.Domain.Entities.ProcessStepExecution", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Musify.Domain.Entities.ProcessExecution", "ProcessExecution")
|
||||||
|
.WithMany("Steps")
|
||||||
|
.HasForeignKey("ProcessExecutionId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("ProcessExecution");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Musify.Domain.Entities.UserHasTrack", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Musify.Domain.Entities.Track", "Track")
|
||||||
|
.WithMany("UserTracks")
|
||||||
|
.HasForeignKey("TrackId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("Musify.Domain.Entities.User", "User")
|
||||||
|
.WithMany("UserTracks")
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Track");
|
||||||
|
|
||||||
|
b.Navigation("User");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Musify.Domain.Entities.PlayList", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("PlayListTracks");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Musify.Domain.Entities.ProcessExecution", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Steps");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Musify.Domain.Entities.Track", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("PlayListTracks");
|
||||||
|
|
||||||
|
b.Navigation("UserTracks");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Musify.Domain.Entities.User", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("PlayLists");
|
||||||
|
|
||||||
|
b.Navigation("UserTracks");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user