-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5f03bb7
commit c6bec87
Showing
37 changed files
with
1,354 additions
and
145 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
8 changes: 8 additions & 0 deletions
8
src/VirtoCommerce.PushMessages.Core/BackgroundJobs/IPushMessageJobService.cs
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,8 @@ | ||
using System.Threading.Tasks; | ||
|
||
namespace VirtoCommerce.PushMessages.Core.BackgroundJobs; | ||
|
||
public interface IPushMessageJobService | ||
{ | ||
Task StartStopRecurringJobs(); | ||
} |
15 changes: 15 additions & 0 deletions
15
src/VirtoCommerce.PushMessages.Core/Extensions/PushMessageExtensions.cs
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,15 @@ | ||
using VirtoCommerce.Platform.Core.Common; | ||
using VirtoCommerce.Platform.Core.Events; | ||
using VirtoCommerce.PushMessages.Core.Models; | ||
|
||
namespace VirtoCommerce.PushMessages.Core.Extensions; | ||
|
||
public static class PushMessageExtensions | ||
{ | ||
public static bool IsSent(this GenericChangedEntry<PushMessage> entry) | ||
{ | ||
return entry.NewEntry.Status == PushMessageStatus.Sent && | ||
(entry.EntryState == EntryState.Added || | ||
entry.EntryState == EntryState.Modified && entry.OldEntry.Status != PushMessageStatus.Sent); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
src/VirtoCommerce.PushMessages.Core/Extensions/SearchServiceExtensions.cs
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,31 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using VirtoCommerce.Platform.Core.Common; | ||
using VirtoCommerce.Platform.Core.GenericCrud; | ||
|
||
namespace VirtoCommerce.PushMessages.Core.Extensions | ||
{ | ||
public static class SearchServiceExtensions | ||
{ | ||
public static async Task SearchWhileResultIsNotEmpty<TCriteria, TResult, TModel>(this ISearchService<TCriteria, TResult, TModel> searchService, TCriteria searchCriteria, Func<TResult, Task> action) | ||
where TCriteria : SearchCriteriaBase | ||
where TResult : GenericSearchResult<TModel> | ||
where TModel : IEntity | ||
{ | ||
TResult searchResult; | ||
|
||
do | ||
{ | ||
searchResult = await searchService.SearchAsync(searchCriteria); | ||
|
||
if (searchResult.Results.Count > 0) | ||
{ | ||
await action(searchResult); | ||
} | ||
} | ||
while (searchCriteria.Take > 0 && | ||
searchResult.Results.Count == searchCriteria.Take && | ||
searchResult.Results.Count != searchResult.TotalCount); | ||
} | ||
} | ||
} |
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
4 changes: 4 additions & 0 deletions
4
src/VirtoCommerce.PushMessages.Core/Models/PushMessageSearchCriteria.cs
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 |
---|---|---|
@@ -1,7 +1,11 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using VirtoCommerce.Platform.Core.Common; | ||
|
||
namespace VirtoCommerce.PushMessages.Core.Models; | ||
|
||
public class PushMessageSearchCriteria : SearchCriteriaBase | ||
{ | ||
public DateTime? StartDateBefore { get; set; } | ||
public IList<string> Statuses { get; set; } | ||
} |
7 changes: 7 additions & 0 deletions
7
src/VirtoCommerce.PushMessages.Core/Models/PushMessageStatus.cs
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,7 @@ | ||
namespace VirtoCommerce.PushMessages.Core.Models; | ||
|
||
public static class PushMessageStatus | ||
{ | ||
public const string Scheduled = "Scheduled"; | ||
public const string Sent = "Sent"; | ||
} |
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
193 changes: 193 additions & 0 deletions
193
src/VirtoCommerce.PushMessages.Data.MySql/Migrations/20240422153122_AddStartDate.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.