refactoring
This commit is contained in:
parent
a983b0fdc4
commit
b828b06904
10 changed files with 125 additions and 26 deletions
|
|
@ -5,13 +5,13 @@ using Microsoft.Extensions.Localization;
|
||||||
|
|
||||||
namespace Yavsc.ApiControllers
|
namespace Yavsc.ApiControllers
|
||||||
{
|
{
|
||||||
|
using YavscLib;
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Models;
|
using Models;
|
||||||
using Services;
|
using Services;
|
||||||
using Yavsc.Interfaces.Workflow;
|
|
||||||
using Yavsc.Models.Haircut;
|
using Yavsc.Models.Haircut;
|
||||||
using Yavsc.Resources;
|
using Yavsc.Resources;
|
||||||
|
|
||||||
|
|
@ -54,8 +54,8 @@ namespace Yavsc.ApiControllers
|
||||||
var now = DateTime.Now;
|
var now = DateTime.Now;
|
||||||
var result = _context.HairCutQueries.Where(
|
var result = _context.HairCutQueries.Where(
|
||||||
q=>q.ClientId == uid
|
q=>q.ClientId == uid
|
||||||
&& q.EventDate > now
|
&& q.EventDate > now
|
||||||
&& q.Status == QueryStatus.Inserted
|
&& q.Status == QueryStatus.Inserted
|
||||||
);
|
);
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
|
|
@ -73,4 +73,4 @@ namespace Yavsc.ApiControllers
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
using Microsoft.Data.Entity.Migrations;
|
using Microsoft.Data.Entity.Migrations;
|
||||||
using Yavsc.Interfaces.Workflow;
|
|
||||||
|
|
||||||
namespace Yavsc.Migrations
|
namespace Yavsc.Migrations
|
||||||
{
|
{
|
||||||
|
using YavscLib;
|
||||||
public partial class bookQueryStatus : Migration
|
public partial class bookQueryStatus : Migration
|
||||||
{
|
{
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
namespace Yavsc.Models.Billing
|
namespace Yavsc.Models.Billing
|
||||||
{
|
{
|
||||||
using Interfaces.Workflow;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Workflow;
|
using Workflow;
|
||||||
using YavscLib;
|
using YavscLib;
|
||||||
|
|
@ -67,4 +66,4 @@ namespace Yavsc.Models.Billing
|
||||||
[ForeignKey("ActivityCode"),JsonIgnore]
|
[ForeignKey("ActivityCode"),JsonIgnore]
|
||||||
public virtual Activity Context { get; set ; }
|
public virtual Activity Context { get; set ; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,10 @@ using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using Yavsc.Models.Billing;
|
using Yavsc.Models.Billing;
|
||||||
using Yavsc.Models.Relationship;
|
using Yavsc.Models.Relationship;
|
||||||
using YavscLib.HairCut;
|
|
||||||
|
|
||||||
namespace Yavsc.Models.Haircut
|
namespace Yavsc.Models.Haircut
|
||||||
{
|
{
|
||||||
public class HairCutQuery : NominativeServiceCommand, IHairCutQuery
|
public class HairCutQuery : NominativeServiceCommand
|
||||||
{
|
{
|
||||||
[Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
[Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
public long Id { get; set; }
|
public long Id { get; set; }
|
||||||
|
|
|
||||||
47
Yavsc/Models/Haircut/Views/HaircutQueryInfo.cs
Normal file
47
Yavsc/Models/Haircut/Views/HaircutQueryInfo.cs
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
using System;
|
||||||
|
using Yavsc.Models.Auth;
|
||||||
|
using Yavsc.Models.Relationship;
|
||||||
|
using YavscLib;
|
||||||
|
|
||||||
|
namespace Yavsc.Models.Haircut.Views
|
||||||
|
{
|
||||||
|
public class HaircutQueryProviderInfo : HaircutQueryComonInfo {
|
||||||
|
public HaircutQueryProviderInfo(HairCutQuery query) : base (query)
|
||||||
|
{
|
||||||
|
ClientInfo = new UserInfo(query.Client);
|
||||||
|
}
|
||||||
|
public UserInfo ClientInfo { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
public class HaircutQueryClientInfo : HaircutQueryComonInfo {
|
||||||
|
public HaircutQueryClientInfo(HairCutQuery query) : base (query)
|
||||||
|
{
|
||||||
|
ProviderInfo = new UserInfo(query.PerformerProfile.Performer);
|
||||||
|
}
|
||||||
|
public UserInfo ProviderInfo { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
public class HaircutQueryComonInfo
|
||||||
|
{
|
||||||
|
public HaircutQueryComonInfo(HairCutQuery query)
|
||||||
|
{
|
||||||
|
Id = query.Id;
|
||||||
|
Prestation = query.Prestation;
|
||||||
|
Status = query.Status;
|
||||||
|
Location = query.Location;
|
||||||
|
EventDate = query.EventDate;
|
||||||
|
}
|
||||||
|
public long Id { get; set; }
|
||||||
|
public HairPrestation Prestation { get; set; }
|
||||||
|
|
||||||
|
public QueryStatus Status { get; set; }
|
||||||
|
|
||||||
|
public virtual Location Location { get; set; }
|
||||||
|
public DateTime? EventDate
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
namespace Yavsc.Models.Workflow
|
namespace Yavsc.Models.Workflow
|
||||||
{
|
{
|
||||||
using Interfaces.Workflow;
|
|
||||||
using YavscLib;
|
using YavscLib;
|
||||||
|
|
||||||
public interface IQuery: IBaseTrackedEntity
|
public interface IQuery: IBaseTrackedEntity
|
||||||
{
|
{
|
||||||
QueryStatus Status { get; set; }
|
QueryStatus Status { get; set; }
|
||||||
|
|
|
||||||
65
YavscLib/HairCut/Haircut.cs
Normal file
65
YavscLib/HairCut/Haircut.cs
Normal file
|
|
@ -0,0 +1,65 @@
|
||||||
|
using System;
|
||||||
|
namespace YavscLib.Haircut
|
||||||
|
{
|
||||||
|
public interface IProviderInfo
|
||||||
|
{
|
||||||
|
|
||||||
|
string UserId
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
|
string UserName
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
|
string Avatar
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface IHaircutQuery
|
||||||
|
{
|
||||||
|
|
||||||
|
IProviderInfo ProviderInfo
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
|
long Id
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
|
IHairPrestation Prestation
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
|
long Status
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
|
ILocation Location
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
|
DateTime EventDate
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
namespace YavscLib.HairCut
|
|
||||||
{
|
|
||||||
public interface IHairCutQuery
|
|
||||||
{
|
|
||||||
long Id { get; set; }
|
|
||||||
long PrestationId { get; set; }
|
|
||||||
|
|
||||||
long? LocationId { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
namespace YavscLib.HairCut
|
namespace YavscLib
|
||||||
{
|
{
|
||||||
public interface IPrestation
|
public interface IHairPrestation
|
||||||
{
|
{
|
||||||
long Id { get; set; }
|
long Id { get; set; }
|
||||||
int Length { get; set; }
|
int Length { get; set; }
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
namespace Yavsc.Interfaces.Workflow
|
namespace YavscLib
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Status,
|
/// Status,
|
||||||
/// should be associated to any
|
/// should be associated to any
|
||||||
/// client user query to a provider user or
|
/// client user query to a provider user or
|
||||||
/// other external entity.
|
/// other external entity.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum QueryStatus: int
|
public enum QueryStatus: int
|
||||||
|
|
@ -17,4 +17,4 @@ namespace Yavsc.Interfaces.Workflow
|
||||||
Failed,
|
Failed,
|
||||||
Success
|
Success
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue