Skip to content

Commit

Permalink
Replace e-mail sender with an http function
Browse files Browse the repository at this point in the history
  • Loading branch information
romankr committed Dec 10, 2023
1 parent afeb7f8 commit 6617c04
Show file tree
Hide file tree
Showing 61 changed files with 691 additions and 923 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/master-build-and-verify-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
jobs:
build:

runs-on: windows-latest
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/master_oddscollector-functions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Docs for the Azure Web Apps Deploy action: https://github.com/azure/functions-action
# More GitHub Actions for Azure: https://github.com/Azure/actions

name: Build and deploy dotnet core app to Azure Function App - oddscollector-functions

on:
push:
branches:
- master
workflow_dispatch:

env:
AZURE_FUNCTIONAPP_PACKAGE_PATH: 'OddsCollector.Functions' # set this to the path to your web app project, defaults to the repository root
DOTNET_VERSION: '8.0.x' # set this to the dotnet version to use

jobs:
build-and-deploy:
runs-on: windows-latest
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@v4

- name: Setup DotNet ${{ env.DOTNET_VERSION }} Environment
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: 'Resolve Project Dependencies Using Dotnet'
shell: pwsh
run: |
pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
dotnet build --configuration Release --output ./output
popd
- name: 'Run Azure Functions Action'
uses: Azure/functions-action@v1
id: fa
with:
app-name: 'oddscollector-functions'
slot-name: 'Production'
package: '${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}/output'
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_84942172C4BE4DDDBE1C48EFB32A2A9A }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using OddsCollector.Functions.Models;
using OddsCollector.Functions.Strategies;

namespace OddsCollector.Functions.Tests.Common.Models;

internal static class EventPredictionBuilderExtensions
{
public const string DefaultId = "4acd8f2675ca847ba33eea3664f6c0bb";
public const string DefaultAwayTeam = "Liverpool";
public const string DefaultBookmaker = "betclic";
public const string DefaultHomeTeam = "Manchester City";
public const string DefaultStrategy = nameof(AdjustedConsensusStrategy);
public const string DefaultWinner = "Manchester City";
public static readonly DateTime DefaultCommenceTime = new(2023, 11, 25, 12, 30, 0);
public static readonly Guid DefaultTraceId = new("447b57dd-84bc-4e79-95d0-695f7493bf41");
public static readonly DateTime DefaultTimestamp = new(2023, 11, 25, 15, 30, 0);

public static EventPredictionBuilder SetDefaults(this EventPredictionBuilder builder)
{
return builder
.SetId(DefaultId)
.SetAwayTeam(DefaultAwayTeam)
.SetBookmaker(DefaultBookmaker)
.SetCommenceTime(DefaultCommenceTime)
.SetHomeTeam(DefaultHomeTeam)
.SetStrategy(DefaultStrategy)
.SetTraceId(DefaultTraceId)
.SetTimestamp(DefaultTimestamp)
.SetWinner(DefaultWinner);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using OddsCollector.Functions.Models;

namespace OddsCollector.Functions.Tests.Common.Models;

internal static class OddsBuilderExtensions
{
public const double DefaultAway1 = 4.08;
public const string DefaultBookmaker1 = "betclic";
public const double DefaultDraw1 = 3.82;
public const double DefaultHome1 = 1.8;

public const double DefaultAway2 = 4.33;
public const string DefaultBookmaker2 = "sport888";
public const double DefaultDraw2 = 4.33;
public const double DefaultHome2 = 1.7;

public const double DefaultAway3 = 4.5;
public const string DefaultBookmaker3 = "mybookieag";
public const double DefaultDraw3 = 4.5;
public const double DefaultHome3 = 1.67;

public static OddBuilder SetDefaults1(this OddBuilder builder)
{
return builder
.SetAway(DefaultAway1)
.SetBookmaker(DefaultBookmaker1)
.SetHome(DefaultHome1)
.SetDraw(DefaultDraw1);
}

public static OddBuilder SetDefaults2(this OddBuilder builder)
{
return builder
.SetAway(DefaultAway2)
.SetBookmaker(DefaultBookmaker2)
.SetHome(DefaultHome2)
.SetDraw(DefaultDraw2);
}

public static OddBuilder SetDefaults3(this OddBuilder builder)
{
return builder
.SetAway(DefaultAway3)
.SetBookmaker(DefaultBookmaker3)
.SetHome(DefaultHome3)
.SetDraw(DefaultDraw3);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using OddsCollector.Functions.Models;

namespace OddsCollector.Functions.Tests.Strategies;
namespace OddsCollector.Functions.Tests.Common.Models;

internal static class UpcomingEventBuilderExtensions
{
Expand All @@ -13,9 +13,9 @@ internal static class UpcomingEventBuilderExtensions

public static readonly IEnumerable<Odd> DefaultOdds = new List<Odd>
{
new OddBuilder().SetDefaults().Instance,
new OddBuilder().SetAway(4.33).SetBookmaker("sport888").SetDraw(4.33).SetHome(1.7).Instance,
new OddBuilder().SetAway(4.5).SetBookmaker("mybookieag").SetDraw(4.5).SetHome(1.67).Instance
new OddBuilder().SetDefaults1().Instance,
new OddBuilder().SetDefaults2().Instance,
new OddBuilder().SetDefaults3().Instance
};

public static UpcomingEventBuilder SetDefaults(this UpcomingEventBuilder builder)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using OddsCollector.Functions.OddsApi.WebApi;

namespace OddsCollector.Functions.Tests.OddsApi.Converter;
namespace OddsCollector.Functions.Tests.Common.OddsApi.WebApi;

[Parallelizable(ParallelScope.All)]
internal class TestAnonymous2Builder
Expand All @@ -10,33 +10,38 @@ internal class TestAnonymous2Builder
public const string DefaultId = "4acd8f2675ca847ba33eea3664f6c0bb";
public static readonly DateTime DefaultCommenceTime = new(2023, 11, 25, 12, 30, 0);

public static readonly ICollection<Bookmakers> DefaultBookmakers = [
new()
public static readonly ICollection<Bookmakers> DefaultBookmakers =
[
new Bookmakers
{
Key = "betclic",
Markets = [
new()
Markets =
[
new Markets2
{
Key = Markets2Key.H2h,
Outcomes = [
new() { Name = "Liverpool", Price = 4.08 },
new() { Name = "Manchester City", Price = 1.7 },
new() { Name = "Draw", Price = 3.82 }
Outcomes =
[
new Outcome { Name = "Liverpool", Price = 4.08 },
new Outcome { Name = "Manchester City", Price = 1.7 },
new Outcome { Name = "Draw", Price = 3.82 }
]
}
]
},
new()
new Bookmakers
{
Key = "sport888",
Markets = [
new()
Markets =
[
new Markets2
{
Key = Markets2Key.H2h,
Outcomes = [
new() { Name = "Liverpool", Price = 4.33 },
new() { Name = "Manchester City", Price = 1.7 },
new() { Name = "Draw", Price = 4.33 }
Outcomes =
[
new Outcome { Name = "Liverpool", Price = 4.33 },
new Outcome { Name = "Manchester City", Price = 1.7 },
new Outcome { Name = "Draw", Price = 4.33 }
]
}
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using OddsCollector.Functions.OddsApi.WebApi;

namespace OddsCollector.Functions.Tests.OddsApi.Converter;
namespace OddsCollector.Functions.Tests.Common.OddsApi.WebApi;

[Parallelizable(ParallelScope.All)]
internal sealed class TestAnonymous3Builder
Expand All @@ -11,9 +11,10 @@ internal sealed class TestAnonymous3Builder
public const string DefaultId = "4acd8f2675ca847ba33eea3664f6c0bb";
public static readonly DateTime DefaultCommenceTime = new(2023, 11, 25, 12, 30, 0);

public static readonly ICollection<ScoreModel> DefaultScores = [
new() { Name = "Manchester City", Score = "1" },
new() { Name = "Liverpool", Score = "0" }
public static readonly ICollection<ScoreModel> DefaultScores =
[
new ScoreModel { Name = "Manchester City", Score = "1" },
new ScoreModel { Name = "Liverpool", Score = "0" }
];

public Anonymous3 Instance { get; } = new();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Azure.Core.Amqp;
using Azure.Messaging.ServiceBus;

namespace OddsCollector.Functions.Tests.ServiceBus;
namespace OddsCollector.Functions.Tests.Common.ServiceBus;

internal static class ServiceBusReceivedMessageFactory
{
Expand Down

This file was deleted.

Loading

0 comments on commit 6617c04

Please sign in to comment.