mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-21 05:43:19 -07:00
Added a notification model to the notifiers.
Added the backend work for sending a notification for an issue report #75
This commit is contained in:
parent
5b90fa9089
commit
0585ff73ec
11 changed files with 245 additions and 66 deletions
|
@ -182,7 +182,7 @@ namespace PlexRequests.UI.Modules
|
|||
var movieInfo = movieApi.GetMovieInformation(movieId).Result;
|
||||
Log.Trace("Getting movie info from TheMovieDb");
|
||||
Log.Trace(movieInfo.DumpJson);
|
||||
//#if !DEBUG
|
||||
//#if !DEBUG
|
||||
try
|
||||
{
|
||||
if (CheckIfTitleExistsInPlex(movieInfo.Title, movieInfo.ReleaseDate?.Year.ToString()))
|
||||
|
@ -194,7 +194,7 @@ namespace PlexRequests.UI.Modules
|
|||
{
|
||||
return Response.AsJson(new JsonResponseModel { Result = false, Message = $"We could not check if {movieInfo.Title} is in Plex, are you sure it's correctly setup?" });
|
||||
}
|
||||
//#endif
|
||||
//#endif
|
||||
|
||||
var model = new RequestedModel
|
||||
{
|
||||
|
@ -241,7 +241,8 @@ namespace PlexRequests.UI.Modules
|
|||
Log.Debug("Adding movie to database requests");
|
||||
var id = RequestService.AddRequest(model);
|
||||
|
||||
NotificationService.Publish(model.Title, model.RequestedBy);
|
||||
var notificationModel = new NotificationModel { Title = model.Title, User = model.RequestedBy, DateTime = DateTime.Now, NotificationType = NotificationType.NewRequest };
|
||||
NotificationService.Publish(notificationModel);
|
||||
|
||||
return Response.AsJson(new JsonResponseModel { Result = true });
|
||||
}
|
||||
|
@ -269,7 +270,7 @@ namespace PlexRequests.UI.Modules
|
|||
var tvApi = new TvMazeApi();
|
||||
|
||||
var showInfo = tvApi.ShowLookupByTheTvDbId(showId);
|
||||
//#if !DEBUG
|
||||
//#if !DEBUG
|
||||
try
|
||||
{
|
||||
if (CheckIfTitleExistsInPlex(showInfo.name, showInfo.premiered?.Substring(0, 4))) // Take only the year Format = 2014-01-01
|
||||
|
@ -281,7 +282,7 @@ namespace PlexRequests.UI.Modules
|
|||
{
|
||||
return Response.AsJson(new JsonResponseModel { Result = false, Message = $"We could not check if {showInfo.name} is in Plex, are you sure it's correctly setup?" });
|
||||
}
|
||||
//#endif
|
||||
//#endif
|
||||
|
||||
DateTime firstAir;
|
||||
DateTime.TryParse(showInfo.premiered, out firstAir);
|
||||
|
@ -344,7 +345,9 @@ namespace PlexRequests.UI.Modules
|
|||
}
|
||||
|
||||
RequestService.AddRequest(model);
|
||||
NotificationService.Publish(model.Title, model.RequestedBy);
|
||||
|
||||
var notificationModel = new NotificationModel { Title = model.Title, User = model.RequestedBy, DateTime = DateTime.Now, NotificationType = NotificationType.NewRequest };
|
||||
NotificationService.Publish(notificationModel);
|
||||
|
||||
return Response.AsJson(new { Result = true });
|
||||
}
|
||||
|
|
|
@ -13,21 +13,22 @@
|
|||
layout="${date} ${logger} ${level}: ${message}" />
|
||||
|
||||
|
||||
<!--<target name="Database" xsi:type="Database"
|
||||
dbProvider="Mono.Data.Sqlite,Mono.Data.Sqlite" keepConnection="false"
|
||||
connectionString="Data Source=PlexRequests.sqlite"
|
||||
commandText="INSERT into Log(Date, Level, Logger, Callsite, Message)
|
||||
values(@Date, @Loglevel, @Logger, @Callsite, @Message)">
|
||||
<target name="Database" xsi:type="Database"
|
||||
dbProvider="Mono.Data.Sqlite.SqliteConnection, Mono.Data.Sqlite, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" keepConnection="false"
|
||||
connectionString="Data Source=PlexRequests.sqlite, version=3"
|
||||
commandText="INSERT into Logs(Date, Level, Logger, Callsite, Message, Exception)
|
||||
values(@Date, @Loglevel, @Logger, @Callsite, @Message, @Exception)">
|
||||
<parameter name="@Date" layout="${longdate}"/>
|
||||
<parameter name="@Loglevel" layout="${level:uppercase=true}"/>
|
||||
<parameter name="@Logger" layout="${logger}"/>
|
||||
<parameter name="@Callsite" layout="${callsite:filename=true}"/>
|
||||
<parameter name="@Message" layout="${message}"/>
|
||||
</target>-->
|
||||
<parameter name="@Exception" layout="${exception:format=tostring}"/>
|
||||
</target>
|
||||
|
||||
</targets>
|
||||
<rules>
|
||||
<logger name="*" minlevel="Trace" writeTo="filelog" />
|
||||
<!--<logger name="*" minlevel="Trace" writeTo="Database" />-->
|
||||
<logger name="*" minlevel="Trace" writeTo="Database" />
|
||||
</rules>
|
||||
</nlog>
|
|
@ -61,7 +61,6 @@ namespace PlexRequests.UI
|
|||
}
|
||||
port = portResult;
|
||||
}
|
||||
|
||||
Log.Trace("Getting product version");
|
||||
WriteOutVersion();
|
||||
|
||||
|
@ -126,7 +125,7 @@ namespace PlexRequests.UI
|
|||
{
|
||||
CommandType = CommandType.Text,
|
||||
ConnectionString = connectionString,
|
||||
DBProvider = "Mono.Data.Sqlite, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756",
|
||||
DBProvider = "Mono.Data.Sqlite.SqliteConnection, Mono.Data.Sqlite, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756",
|
||||
Name = "database"
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue