-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Copy
Models
from VocaDbWeb to VocaDbWeb.Core
- Loading branch information
1 parent
590d575
commit 29bf06b
Showing
174 changed files
with
4,407 additions
and
0 deletions.
There are no files selected for viewing
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,24 @@ | ||
#nullable disable | ||
|
||
using System; | ||
using VocaDb.Model.DataContracts; | ||
|
||
namespace VocaDb.Web.Models.Admin | ||
{ | ||
[Obsolete] | ||
public class CommentViewModel | ||
{ | ||
public CommentViewModel(CommentContract comment, string targetName, string targetUrl) | ||
{ | ||
Comment = comment; | ||
TargetName = targetName; | ||
TargetUrl = targetUrl; | ||
} | ||
|
||
public CommentContract Comment { get; set; } | ||
|
||
public string TargetName { get; set; } | ||
|
||
public string TargetUrl { 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 @@ | ||
#nullable disable | ||
|
||
using System.Collections.Generic; | ||
using System.Linq; | ||
using VocaDb.Model; | ||
using VocaDb.Model.DataContracts.Songs; | ||
|
||
namespace VocaDb.Web.Models.Admin | ||
{ | ||
public class PVsByAuthor | ||
{ | ||
public PVsByAuthor() { } | ||
|
||
public PVsByAuthor(string author, IEnumerable<PVForSongContract> pvs) | ||
{ | ||
ParamIs.NotNull(() => author); | ||
ParamIs.NotNull(() => pvs); | ||
|
||
Author = author; | ||
PVs = pvs.ToArray(); | ||
} | ||
|
||
public string Author { get; set; } | ||
|
||
public PVForSongContract[] PVs { 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,42 @@ | ||
#nullable disable | ||
|
||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Newtonsoft.Json; | ||
using VocaDb.Model; | ||
using VocaDb.Model.Service; | ||
using VocaDb.Web.Helpers; | ||
|
||
namespace VocaDb.Web.Models.Admin | ||
{ | ||
[JsonObject(MemberSerialization.OptIn)] | ||
public class ViewAuditLogModel | ||
{ | ||
public ViewAuditLogModel() | ||
{ | ||
GroupId = AuditLogUserGroupFilter.NoFilter; | ||
|
||
UserGroups = new[] { | ||
new KeyValuePair<AuditLogUserGroupFilter, string>(AuditLogUserGroupFilter.NoFilter, "No group filter") | ||
}.Concat(Translate.UserGroups.Values.Select(u => new KeyValuePair<AuditLogUserGroupFilter, string>(EnumVal<AuditLogUserGroupFilter>.Parse(u.ToString()), Translate.UserGroups[u]))) | ||
.ToArray(); | ||
} | ||
|
||
[JsonProperty] | ||
public string ExcludeUsers { get; set; } | ||
|
||
[JsonProperty] | ||
public string Filter { get; set; } | ||
|
||
[JsonProperty] | ||
public AuditLogUserGroupFilter GroupId { get; set; } | ||
|
||
[JsonProperty] | ||
public bool OnlyNewUsers { get; set; } | ||
|
||
public KeyValuePair<AuditLogUserGroupFilter, string>[] UserGroups { get; set; } | ||
|
||
[JsonProperty] | ||
public string UserName { 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,19 @@ | ||
#nullable disable | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Web; | ||
|
||
namespace VocaDb.Web.Models.Admin | ||
{ | ||
public class ViewSysLog | ||
{ | ||
public ViewSysLog(string logContents) | ||
{ | ||
LogContents = logContents; | ||
} | ||
|
||
public string LogContents { 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,37 @@ | ||
#nullable disable | ||
|
||
using VocaDb.Model; | ||
using VocaDb.Model.Domain.Albums; | ||
using VocaDb.Model.Service; | ||
|
||
namespace VocaDb.Web.Models.Album | ||
{ | ||
/// <summary> | ||
/// Parameter collection given to index action. | ||
/// </summary> | ||
public class IndexRouteParams | ||
{ | ||
public IndexRouteParams() { } | ||
|
||
public IndexRouteParams(IndexRouteParams source, int? page) | ||
{ | ||
ParamIs.NotNull(() => source); | ||
|
||
discType = (source.discType != DiscType.Unknown ? source.discType : null); | ||
draftsOnly = (source.draftsOnly == true ? source.draftsOnly : null); | ||
filter = source.filter; | ||
matchMode = source.matchMode; | ||
sort = source.sort; | ||
view = source.view; | ||
this.page = page; | ||
} | ||
|
||
public DiscType? discType { get; set; } | ||
public bool? draftsOnly { get; set; } | ||
public string filter { get; set; } | ||
public NameMatchMode? matchMode { get; set; } | ||
public int? page { get; set; } | ||
public AlbumSortRule? sort { get; set; } | ||
public EntryViewMode? view { 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,53 @@ | ||
#nullable disable | ||
|
||
using System.Linq; | ||
using VocaDb.Model.DataContracts.Albums; | ||
using VocaDb.Model; | ||
using VocaDb.Web.Models.Shared; | ||
using VocaDb.Model.Domain.Albums; | ||
using VocaDb.Web.Helpers; | ||
|
||
namespace VocaDb.Web.Models.Album | ||
{ | ||
public class Versions | ||
{ | ||
public static ArchivedObjectVersion CreateForAlbum(ArchivedAlbumVersionContract album) | ||
{ | ||
return new ArchivedObjectVersion(album, GetReasonName(album.Reason, album.Notes), | ||
GetChangeString(album.ChangedFields), album.Reason != AlbumArchiveReason.PropertiesUpdated || album.ChangedFields != AlbumEditableFields.Nothing); | ||
} | ||
|
||
public static string GetChangeString(AlbumEditableFields fields) | ||
{ | ||
if (fields == AlbumEditableFields.Nothing) | ||
return string.Empty; | ||
|
||
var fieldNames = EnumVal<AlbumEditableFields>.Values.Where(f => | ||
f != AlbumEditableFields.Nothing && fields.HasFlag(f)).Select(Translate.AlbumEditableField); | ||
|
||
return string.Join(", ", fieldNames); | ||
} | ||
|
||
private static string GetReasonName(AlbumArchiveReason reason, string notes) | ||
{ | ||
if (reason == AlbumArchiveReason.Unknown) | ||
return notes; | ||
|
||
return Translate.AlbumArchiveReason(reason); | ||
} | ||
|
||
public Versions() { } | ||
|
||
public Versions(AlbumWithArchivedVersionsContract contract) | ||
{ | ||
ParamIs.NotNull(() => contract); | ||
|
||
Album = contract; | ||
ArchivedVersions = contract.ArchivedVersions.Select(CreateForAlbum).ToArray(); | ||
} | ||
|
||
public AlbumContract Album { get; set; } | ||
|
||
public ArchivedObjectVersion[] ArchivedVersions { get; set; } | ||
} | ||
} |
Oops, something went wrong.