Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup scheduled task creation #54

Merged
merged 3 commits into from
Feb 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ jobs:
needs: build
environment:
name: "GitHub Packages"
url: https://github.com/web-scheduler/web-scheduler/packages
url: https://github.com/web-scheduler/web-scheduler-api/packages
permissions:
packages: write
runs-on: windows-latest
Expand All @@ -130,7 +130,7 @@ jobs:
with:
name: "ubuntu-latest"
- name: "Dotnet NuGet Add Source"
run: dotnet nuget add source https://nuget.pkg.github.com/web-scheduler/index.json --name GitHub --username web-scheduler --password ${{secrets.GITHUB_TOKEN}}
run: dotnet nuget add source https://nuget.pkg.github.com/web-scheduler-api/index.json --name GitHub --username web-scheduler-api --password ${{secrets.GITHUB_TOKEN}}
shell: pwsh
- name: "Dotnet NuGet Push"
run: dotnet nuget push .\**\*.nupkg --api-key ${{ github.token }} --source GitHub --skip-duplicate
Expand Down
13 changes: 4 additions & 9 deletions Source/WebScheduler.Api.Models/ViewModels/SaveScheduledTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ namespace WebScheduler.Api.ViewModels;
/// </summary>
public class SaveScheduledTask
{
static Random rng = new Random();
public SaveScheduledTask ()
{
this.CronExpression = $"{rng.Next(0, 59)} */1 * * * *";
}
/// <summary>
/// Gets or sets the name of the scheduled task.
/// </summary>
Expand All @@ -33,9 +28,9 @@ public SaveScheduledTask ()
[Display(Name = "Enabled", Description = "Determines if the task is schedulable.", ShortName = "Enabled")]
public bool IsEnabled { get; set; }

public DateTime? LastRunAt { get; set; }
public DateTime? NextRunAt { get; set; }
public string CronExpression { get; set; }

[Required]
[Display(Name = "Schedule", Description = "The schedule to run the task on.")]
public string CronExpression { get; set; } = "* * * * * ";

public SaveScheduledTask ShallowCopy() => (SaveScheduledTask)this.MemberwiseClone();
}
2 changes: 2 additions & 0 deletions Source/WebScheduler.Api.Models/ViewModels/ScheduledTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,6 @@ public class ScheduledTask
public DateTime ModifiedAt{ get; set; }
public DateTime CreatedAt { get; set; }
public string CronExpression { get; set; } = "* * * * *";

public ScheduledTask ShallowCopy() => (ScheduledTask)this.MemberwiseClone();
}