#67 golha.co.uk search api is now complete
This commit is contained in:
parent
ac063905c5
commit
90a58dd6e0
68
RMuseum/Controllers/MusicCatalogueController.cs
Normal file
68
RMuseum/Controllers/MusicCatalogueController.cs
Normal file
@ -0,0 +1,68 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using RMuseum.Models.MusicCatalogue.ViewModels;
|
||||
using RMuseum.Services;
|
||||
using RSecurityBackend.Models.Generic;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RMuseum.Controllers
|
||||
{
|
||||
[Produces("application/json")]
|
||||
[Route("api/musiccatalogue")]
|
||||
public class MusicCatalogueController : Controller
|
||||
{
|
||||
/// <summary>
|
||||
/// golha collection programs
|
||||
/// </summary>
|
||||
/// <param name="id">collection id</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("golha/collection/{id}/programs")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(GolhaProgramViewModel[]))]
|
||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||
public async Task<IActionResult> GetGolhaCollectionPrograms(int id)
|
||||
{
|
||||
RServiceResult<GolhaProgramViewModel[]> res =
|
||||
await _catalogueService.GetGolhaCollectionPrograms(id);
|
||||
if (!string.IsNullOrEmpty(res.ExceptionString))
|
||||
return BadRequest(res.ExceptionString);
|
||||
return Ok(res.Result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// program tracks
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("golha/program/{id}/tracks")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(GolhaTrackViewModel[]))]
|
||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||
public async Task<IActionResult> GetGolhaProgramTracks(int id)
|
||||
{
|
||||
RServiceResult<GolhaTrackViewModel[]> res =
|
||||
await _catalogueService.GetGolhaProgramTracks(id);
|
||||
if (!string.IsNullOrEmpty(res.ExceptionString))
|
||||
return BadRequest(res.ExceptionString);
|
||||
return Ok(res.Result);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Catalogue Service
|
||||
/// </summary>
|
||||
protected readonly IMusicCatalogueService _catalogueService;
|
||||
|
||||
/// <summary>
|
||||
/// constructor
|
||||
/// </summary>
|
||||
/// <param name="catalogueService"></param>
|
||||
public MusicCatalogueController(IMusicCatalogueService catalogueService)
|
||||
{
|
||||
_catalogueService = catalogueService;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -221,6 +221,11 @@ namespace RMuseum.DbContext
|
||||
/// </summary>
|
||||
public DbSet<GolhaCollection> GolhaCollections { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// GolhaPrograms
|
||||
/// </summary>
|
||||
public DbSet<GolhaProgram> GolhaPrograms { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// PoemMusicTracks
|
||||
/// </summary>
|
||||
|
||||
2063
RMuseum/Migrations/20210118165057_GolhaPrograms.Designer.cs
generated
Normal file
2063
RMuseum/Migrations/20210118165057_GolhaPrograms.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
97
RMuseum/Migrations/20210118165057_GolhaPrograms.cs
Normal file
97
RMuseum/Migrations/20210118165057_GolhaPrograms.cs
Normal file
@ -0,0 +1,97 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace RMuseum.Migrations
|
||||
{
|
||||
public partial class GolhaPrograms : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_GolhaProgram_GolhaCollections_GolhaCollectionId",
|
||||
table: "GolhaProgram");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_GolhaTracks_GolhaProgram_GolhaProgramId",
|
||||
table: "GolhaTracks");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_GolhaProgram",
|
||||
table: "GolhaProgram");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "GolhaProgram",
|
||||
newName: "GolhaPrograms");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_GolhaProgram_GolhaCollectionId",
|
||||
table: "GolhaPrograms",
|
||||
newName: "IX_GolhaPrograms_GolhaCollectionId");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_GolhaPrograms",
|
||||
table: "GolhaPrograms",
|
||||
column: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_GolhaPrograms_GolhaCollections_GolhaCollectionId",
|
||||
table: "GolhaPrograms",
|
||||
column: "GolhaCollectionId",
|
||||
principalTable: "GolhaCollections",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_GolhaTracks_GolhaPrograms_GolhaProgramId",
|
||||
table: "GolhaTracks",
|
||||
column: "GolhaProgramId",
|
||||
principalTable: "GolhaPrograms",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_GolhaPrograms_GolhaCollections_GolhaCollectionId",
|
||||
table: "GolhaPrograms");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_GolhaTracks_GolhaPrograms_GolhaProgramId",
|
||||
table: "GolhaTracks");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_GolhaPrograms",
|
||||
table: "GolhaPrograms");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "GolhaPrograms",
|
||||
newName: "GolhaProgram");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_GolhaPrograms_GolhaCollectionId",
|
||||
table: "GolhaProgram",
|
||||
newName: "IX_GolhaProgram_GolhaCollectionId");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_GolhaProgram",
|
||||
table: "GolhaProgram",
|
||||
column: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_GolhaProgram_GolhaCollections_GolhaCollectionId",
|
||||
table: "GolhaProgram",
|
||||
column: "GolhaCollectionId",
|
||||
principalTable: "GolhaCollections",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_GolhaTracks_GolhaProgram_GolhaProgramId",
|
||||
table: "GolhaTracks",
|
||||
column: "GolhaProgramId",
|
||||
principalTable: "GolhaProgram",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1065,7 +1065,7 @@ namespace RMuseum.Migrations
|
||||
|
||||
b.HasIndex("GolhaCollectionId");
|
||||
|
||||
b.ToTable("GolhaProgram");
|
||||
b.ToTable("GolhaPrograms");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GolhaTrack", b =>
|
||||
@ -1152,34 +1152,6 @@ namespace RMuseum.Migrations
|
||||
b.ToTable("UserNotes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RMuseum.Models.Notification.RUserNotification", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<DateTime>("DateTime")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("HtmlText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Subject")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Notifications");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RMuseum.Models.UploadSession.UploadSession", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
@ -1611,6 +1583,34 @@ namespace RMuseum.Migrations
|
||||
b.HasDiscriminator<string>("Discriminator").HasValue("RImage");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RSecurityBackend.Models.Notification.RUserNotification", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<DateTime>("DateTime")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("HtmlText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Subject")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Notifications");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RMuseum.Models.Artifact.RPictureFile", b =>
|
||||
{
|
||||
b.HasBaseType("RSecurityBackend.Models.Image.RImage");
|
||||
@ -1992,15 +1992,6 @@ namespace RMuseum.Migrations
|
||||
.HasForeignKey("ReferenceNoteId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RMuseum.Models.Notification.RUserNotification", b =>
|
||||
{
|
||||
b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RMuseum.Models.UploadSession.UploadSession", b =>
|
||||
{
|
||||
b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "User")
|
||||
@ -2049,6 +2040,15 @@ namespace RMuseum.Migrations
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RSecurityBackend.Models.Notification.RUserNotification", b =>
|
||||
{
|
||||
b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RMuseum.Models.Artifact.RPictureFile", b =>
|
||||
{
|
||||
b.HasOne("RMuseum.Models.Artifact.RArtifactItemRecord", null)
|
||||
|
||||
@ -4,6 +4,9 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace RMuseum.Models.MusicCatalogue
|
||||
{
|
||||
/// <summary>
|
||||
/// Golha Program
|
||||
/// </summary>
|
||||
public class GolhaProgram
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@ -0,0 +1,33 @@
|
||||
namespace RMuseum.Models.MusicCatalogue.ViewModels
|
||||
{
|
||||
/// <summary>
|
||||
/// Golha Program View Model
|
||||
/// </summary>
|
||||
public class GolhaProgramViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// id
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// title
|
||||
/// </summary>
|
||||
public string Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// program order
|
||||
/// </summary>
|
||||
public int ProgramOrder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// url
|
||||
/// </summary>
|
||||
public string Url { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// mp3
|
||||
/// </summary>
|
||||
public string Mp3 { get; set; }
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
namespace RMuseum.Models.MusicCatalogue.ViewModels
|
||||
{
|
||||
/// <summary>
|
||||
/// Golha Track View Model
|
||||
/// </summary>
|
||||
public class GolhaTrackViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// id
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// track no
|
||||
/// </summary>
|
||||
public int TrackNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// timing
|
||||
/// </summary>
|
||||
public string Timing { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// title
|
||||
/// </summary>
|
||||
public string Title { get; set; }
|
||||
}
|
||||
}
|
||||
@ -803,6 +803,31 @@
|
||||
Artifact Service
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.MusicCatalogueController.GetGolhaCollectionPrograms(System.Int32)">
|
||||
<summary>
|
||||
golha collection programs
|
||||
</summary>
|
||||
<param name="id">collection id</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.MusicCatalogueController.GetGolhaProgramTracks(System.Int32)">
|
||||
<summary>
|
||||
program tracks
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="F:RMuseum.Controllers.MusicCatalogueController._catalogueService">
|
||||
<summary>
|
||||
Catalogue Service
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.MusicCatalogueController.#ctor(RMuseum.Services.IMusicCatalogueService)">
|
||||
<summary>
|
||||
constructor
|
||||
</summary>
|
||||
<param name="catalogueService"></param>
|
||||
</member>
|
||||
<member name="T:RMuseum.Controllers.NoificationController">
|
||||
<summary>
|
||||
Notifications controller
|
||||
@ -1226,6 +1251,11 @@
|
||||
GolhaCollection
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:RMuseum.DbContext.RMuseumDbContext.GolhaPrograms">
|
||||
<summary>
|
||||
GolhaPrograms
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:RMuseum.DbContext.RMuseumDbContext.GanjoorPoemMusicTracks">
|
||||
<summary>
|
||||
PoemMusicTracks
|
||||
@ -4440,6 +4470,11 @@
|
||||
programs
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:RMuseum.Models.MusicCatalogue.GolhaProgram">
|
||||
<summary>
|
||||
Golha Program
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:RMuseum.Models.MusicCatalogue.GolhaProgram.Id">
|
||||
<summary>
|
||||
id
|
||||
@ -4533,6 +4568,61 @@
|
||||
track is purely music and no singing is done through it
|
||||
</example>
|
||||
</member>
|
||||
<member name="T:RMuseum.Models.MusicCatalogue.ViewModels.GolhaProgramViewModel">
|
||||
<summary>
|
||||
Golha Program View Model
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:RMuseum.Models.MusicCatalogue.ViewModels.GolhaProgramViewModel.Id">
|
||||
<summary>
|
||||
id
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:RMuseum.Models.MusicCatalogue.ViewModels.GolhaProgramViewModel.Title">
|
||||
<summary>
|
||||
title
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:RMuseum.Models.MusicCatalogue.ViewModels.GolhaProgramViewModel.ProgramOrder">
|
||||
<summary>
|
||||
program order
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:RMuseum.Models.MusicCatalogue.ViewModels.GolhaProgramViewModel.Url">
|
||||
<summary>
|
||||
url
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:RMuseum.Models.MusicCatalogue.ViewModels.GolhaProgramViewModel.Mp3">
|
||||
<summary>
|
||||
mp3
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:RMuseum.Models.MusicCatalogue.ViewModels.GolhaTrackViewModel">
|
||||
<summary>
|
||||
Golha Track View Model
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:RMuseum.Models.MusicCatalogue.ViewModels.GolhaTrackViewModel.Id">
|
||||
<summary>
|
||||
id
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:RMuseum.Models.MusicCatalogue.ViewModels.GolhaTrackViewModel.TrackNo">
|
||||
<summary>
|
||||
track no
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:RMuseum.Models.MusicCatalogue.ViewModels.GolhaTrackViewModel.Timing">
|
||||
<summary>
|
||||
timing
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:RMuseum.Models.MusicCatalogue.ViewModels.GolhaTrackViewModel.Title">
|
||||
<summary>
|
||||
title
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:RMuseum.Models.Note.RNoteType">
|
||||
<summary>
|
||||
Note Type
|
||||
@ -6496,6 +6586,20 @@
|
||||
Music Catalgue Service Implementation
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.MusicCatalogueService.GetGolhaCollectionPrograms(System.Int32)">
|
||||
<summary>
|
||||
get golha collection programs
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.MusicCatalogueService.GetGolhaProgramTracks(System.Int32)">
|
||||
<summary>
|
||||
get golha program tracks
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.MusicCatalogueService.ImportFromMySql(RSecurityBackend.Services.Implementation.LongRunningJobProgressServiceEF,RSecurityBackend.Models.Generic.Db.RLongRunningJobStatus)">
|
||||
<summary>
|
||||
import catalogue from ganjoor.net MySql db
|
||||
@ -6507,11 +6611,17 @@
|
||||
Configuration
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.MusicCatalogueService.#ctor(Microsoft.Extensions.Configuration.IConfiguration)">
|
||||
<member name="F:RMuseum.Services.Implementation.MusicCatalogueService._context">
|
||||
<summary>
|
||||
Database Contetxt
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.MusicCatalogueService.#ctor(Microsoft.Extensions.Configuration.IConfiguration,RMuseum.DbContext.RMuseumDbContext)">
|
||||
<summary>
|
||||
constructor
|
||||
</summary>
|
||||
<param name="configuration"></param>
|
||||
<param name="context"></param>
|
||||
</member>
|
||||
<member name="T:RMuseum.Services.Implementation.PictureFileService">
|
||||
<summary>
|
||||
@ -6919,6 +7029,25 @@
|
||||
<param name="notificationService"></param>
|
||||
<param name="userService"></param>
|
||||
</member>
|
||||
<member name="T:RMuseum.Services.IMusicCatalogueService">
|
||||
<summary>
|
||||
Music Catalogue Service
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IMusicCatalogueService.GetGolhaCollectionPrograms(System.Int32)">
|
||||
<summary>
|
||||
get golha collection programs
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IMusicCatalogueService.GetGolhaProgramTracks(System.Int32)">
|
||||
<summary>
|
||||
get golha program tracks
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:RMuseum.Services.IPictureFileService">
|
||||
<summary>
|
||||
manipulating picture files
|
||||
|
||||
26
RMuseum/Services/IMusicCatalogueService.cs
Normal file
26
RMuseum/Services/IMusicCatalogueService.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using RMuseum.Models.MusicCatalogue.ViewModels;
|
||||
using RSecurityBackend.Models.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RMuseum.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Music Catalogue Service
|
||||
/// </summary>
|
||||
public interface IMusicCatalogueService
|
||||
{
|
||||
/// <summary>
|
||||
/// get golha collection programs
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<GolhaProgramViewModel[]>> GetGolhaCollectionPrograms(int id);
|
||||
|
||||
/// <summary>
|
||||
/// get golha program tracks
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<GolhaTrackViewModel[]>> GetGolhaProgramTracks(int id);
|
||||
}
|
||||
}
|
||||
@ -1080,7 +1080,7 @@ namespace RMuseum.Services.Implementation
|
||||
var job = (await jobProgressServiceEF.NewJob("GanjoorService:ImportFromMySql", "pre open connection")).Result;
|
||||
|
||||
|
||||
MusicCatalogueService catalogueService = new MusicCatalogueService(Configuration);
|
||||
MusicCatalogueService catalogueService = new MusicCatalogueService(Configuration, context);
|
||||
RServiceResult<bool> musicCatalogueRes = await catalogueService.ImportFromMySql(jobProgressServiceEF, job);
|
||||
|
||||
if (!musicCatalogueRes.Result)
|
||||
|
||||
@ -1,13 +1,16 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using MySql.Data.MySqlClient;
|
||||
using RMuseum.DbContext;
|
||||
using RMuseum.Models.MusicCatalogue;
|
||||
using RMuseum.Models.MusicCatalogue.ViewModels;
|
||||
using RSecurityBackend.Models.Generic;
|
||||
using RSecurityBackend.Models.Generic.Db;
|
||||
using RSecurityBackend.Services.Implementation;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RMuseum.Services.Implementation
|
||||
@ -15,8 +18,64 @@ namespace RMuseum.Services.Implementation
|
||||
/// <summary>
|
||||
/// Music Catalgue Service Implementation
|
||||
/// </summary>
|
||||
public class MusicCatalogueService
|
||||
public class MusicCatalogueService : IMusicCatalogueService
|
||||
{
|
||||
/// <summary>
|
||||
/// get golha collection programs
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<RServiceResult<GolhaProgramViewModel[]>> GetGolhaCollectionPrograms(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return new RServiceResult<GolhaProgramViewModel[]>
|
||||
(
|
||||
await _context.GolhaPrograms.Where(p => p.GolhaCollectionId == id).OrderBy(p => p.Id)
|
||||
.Select(p => new GolhaProgramViewModel()
|
||||
{
|
||||
Id = p.Id,
|
||||
Title = p.Title,
|
||||
Url = p.Url,
|
||||
ProgramOrder = p.ProgramOrder,
|
||||
Mp3 = p.Mp3
|
||||
}).ToArrayAsync()
|
||||
); ;
|
||||
}
|
||||
catch(Exception exp)
|
||||
{
|
||||
return new RServiceResult<GolhaProgramViewModel[]>(null, exp.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// get golha program tracks
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<RServiceResult<GolhaTrackViewModel[]>> GetGolhaProgramTracks(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return new RServiceResult<GolhaTrackViewModel[]>
|
||||
(
|
||||
await _context.GolhaTracks.Where(p => p.GolhaProgramId == id).OrderBy(p => p.Id)
|
||||
.Select(p => new GolhaTrackViewModel()
|
||||
{
|
||||
Id = p.Id,
|
||||
TrackNo = p.TrackNo,
|
||||
Timing = p.Timing,
|
||||
Title = p.Title,
|
||||
}).ToArrayAsync()
|
||||
); ;
|
||||
}
|
||||
catch (Exception exp)
|
||||
{
|
||||
return new RServiceResult<GolhaTrackViewModel[]>(null, exp.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// import catalogue from ganjoor.net MySql db
|
||||
/// </summary>
|
||||
@ -223,14 +282,21 @@ namespace RMuseum.Services.Implementation
|
||||
/// Configuration
|
||||
/// </summary>
|
||||
protected IConfiguration Configuration { get; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Database Contetxt
|
||||
/// </summary>
|
||||
protected readonly RMuseumDbContext _context;
|
||||
|
||||
/// <summary>
|
||||
/// constructor
|
||||
/// </summary>
|
||||
/// <param name="configuration"></param>
|
||||
public MusicCatalogueService(IConfiguration configuration)
|
||||
/// <param name="context"></param>
|
||||
public MusicCatalogueService(IConfiguration configuration, RMuseumDbContext context)
|
||||
{
|
||||
Configuration = configuration;
|
||||
_context = context;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -259,6 +259,9 @@ namespace RMuseum
|
||||
//ganjoor service
|
||||
services.AddTransient<IGanjoorService, GanjoorService>();
|
||||
|
||||
//music catalogue service
|
||||
services.AddTransient<IMusicCatalogueService, MusicCatalogueService>();
|
||||
|
||||
//long running job service
|
||||
services.AddTransient<ILongRunningJobProgressService, LongRunningJobProgressServiceEF>();
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user