Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/build-and-dockerize.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres:17-alpine
image: postgres:18-alpine
ports:
- 5432:5432
# Provide the password for postgres
Expand Down
6 changes: 3 additions & 3 deletions BervProject.WebApi.Boilerplate.MigrationService/Worker.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
namespace BervProject.WebApi.Boilerplate.MigrationService;

using System.Diagnostics;
using BervProject.WebApi.Boilerplate.EntityFramework;
using EntityFramework;
using Microsoft.EntityFrameworkCore;

namespace BervProject.WebApi.Boilerplate.MigrationService;

public class Worker : BackgroundService
{
public const string ActivitySourceName = "Migrations";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.ServiceDiscovery;
using OpenTelemetry;
using OpenTelemetry.Metrics;
using OpenTelemetry.Trace;
Expand Down
62 changes: 35 additions & 27 deletions BervProject.WebApi.Boilerplate/ConfigModel/AWSConfiguration.cs
Original file line number Diff line number Diff line change
@@ -1,30 +1,38 @@
namespace BervProject.WebApi.Boilerplate.ConfigModel
{
public class AWSConfiguration
{
public AWSBasicConfiguration Basic { get; set; }
public AWSEmailConfiguration Email { get; set; }
public AWSDynamoConfiguration Dynamo { get; set; }
}

public class AWSAuth
{
public string AccessKey { get; set; }
public string SecretKey { get; set; }
}
namespace BervProject.WebApi.Boilerplate.ConfigModel;

public class AWSBasicConfiguration
{
public AWSAuth Auth { get; set; }
}

public class AWSDynamoConfiguration
{
public string Location { get; set; }
}
/// <summary>
/// AWS Config
/// </summary>
public class AwsConfiguration
{
/// <summary>
/// Email
/// </summary>
public AwsEmailConfiguration Email { get; set; }
/// <summary>
/// Dynamo
/// </summary>
public AwsDynamoConfiguration Dynamo { get; set; }
}

public class AWSEmailConfiguration
{
public string Location { get; set; }
}
/// <summary>
/// AWS Dynamo Config
/// </summary>
public class AwsDynamoConfiguration
{
/// <summary>
/// Location
/// </summary>
public string Location { get; set; }
}

/// <summary>
/// AWS Email Config
/// </summary>
public class AwsEmailConfiguration
{
/// <summary>
/// Location
/// </summary>
public string Location { get; set; }
}
88 changes: 63 additions & 25 deletions BervProject.WebApi.Boilerplate/ConfigModel/AzureConfiguration.cs
Original file line number Diff line number Diff line change
@@ -1,30 +1,68 @@
namespace BervProject.WebApi.Boilerplate.ConfigModel
{
public class AzureConfiguration
{
public AzureServiceBus ServiceBus { get; set; }
public AzureStorage Storage { get; set; }
}
namespace BervProject.WebApi.Boilerplate.ConfigModel;

public class AzureStorage
{
public StorageQueue Queue { get; set; }
public BlobStorage Blob { get; set; }
}
/// <summary>
/// Azure Config
/// </summary>
public class AzureConfiguration
{
/// <summary>
/// Service Bus
/// </summary>
public AzureServiceBus ServiceBus { get; set; }
/// <summary>
/// Storage
/// </summary>
public AzureStorage Storage { get; set; }
}

public class BlobStorage
{
public string ContainerName { get; set; }
}
/// <summary>
/// Azure Storage
/// </summary>
public class AzureStorage
{
/// <summary>
/// Queue
/// </summary>
public StorageQueue Queue { get; set; }
/// <summary>
/// Blob
/// </summary>
public BlobStorage Blob { get; set; }
}

public class StorageQueue
{
public string QueueName { get; set; }
}
/// <summary>
/// Blob
/// </summary>
public class BlobStorage
{
/// <summary>
/// Container Name
/// </summary>
public string ContainerName { get; set; }
}

public class AzureServiceBus
{
public string QueueName { get; set; }
public string TopicName { get; set; }
}
/// <summary>
/// Queue
/// </summary>
public class StorageQueue
{
/// <summary>
/// Queue Name
/// </summary>
public string QueueName { get; set; }
}

/// <summary>
/// Service Bus
/// </summary>
public class AzureServiceBus
{
/// <summary>
/// Queue Name
/// </summary>
public string QueueName { get; set; }
/// <summary>
/// Topic Name
/// </summary>
public string TopicName { get; set; }
}
4 changes: 2 additions & 2 deletions BervProject.WebApi.Boilerplate/Controllers/AWSS3Controller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
[ApiController]
[Route("api/v{version:apiVersion}/[controller]")]
[ApiVersion("1.0")]
public class SThreeController : ControllerBase

Check warning on line 12 in BervProject.WebApi.Boilerplate/Controllers/AWSS3Controller.cs

View workflow job for this annotation

GitHub Actions / Analyze

Missing XML comment for publicly visible type or member 'SThreeController'

Check warning on line 12 in BervProject.WebApi.Boilerplate/Controllers/AWSS3Controller.cs

View workflow job for this annotation

GitHub Actions / build

Missing XML comment for publicly visible type or member 'SThreeController'
{
private readonly IAWSS3Service _awsS3Service;
public SThreeController(IAWSS3Service awsS3Service)
private readonly IAwsS3Service _awsS3Service;
public SThreeController(IAwsS3Service awsS3Service)

Check warning on line 15 in BervProject.WebApi.Boilerplate/Controllers/AWSS3Controller.cs

View workflow job for this annotation

GitHub Actions / Analyze

Missing XML comment for publicly visible type or member 'SThreeController.SThreeController(IAwsS3Service)'

Check warning on line 15 in BervProject.WebApi.Boilerplate/Controllers/AWSS3Controller.cs

View workflow job for this annotation

GitHub Actions / build

Missing XML comment for publicly visible type or member 'SThreeController.SThreeController(IAwsS3Service)'
{
_awsS3Service = awsS3Service;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using BervProject.WebApi.Boilerplate.Services;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using BervProject.WebApi.Boilerplate.Services.Azure;
using Microsoft.AspNetCore.Http;

namespace BervProject.WebApi.Boilerplate.Controllers
Expand All @@ -9,7 +10,7 @@
[ApiController]
[Route("api/v{version:apiVersion}/[controller]")]
[ApiVersion("1.0")]
public class NoteController : ControllerBase

Check warning on line 13 in BervProject.WebApi.Boilerplate/Controllers/NoteController.cs

View workflow job for this annotation

GitHub Actions / Analyze

Missing XML comment for publicly visible type or member 'NoteController'

Check warning on line 13 in BervProject.WebApi.Boilerplate/Controllers/NoteController.cs

View workflow job for this annotation

GitHub Actions / build

Missing XML comment for publicly visible type or member 'NoteController'
{
private readonly IAzureTableStorageService<Note> _noteTable;
public NoteController(IAzureTableStorageService<Note> noteTable)
Expand Down
31 changes: 21 additions & 10 deletions BervProject.WebApi.Boilerplate/Entities/Book.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
using System;
namespace BervProject.WebApi.Boilerplate.Entities;

using System;
using System.ComponentModel.DataAnnotations;

namespace BervProject.WebApi.Boilerplate.Entities
/// <summary>
/// Book Entity
/// </summary>
public class Book
{
public class Book
{
public Guid Id { get; set; }
[Required]
public string Name { get; set; }
public virtual Publisher Publisher { get; set; }
}
}
/// <summary>
/// Id
/// </summary>
public Guid Id { get; set; }
/// <summary>
/// Name
/// </summary>
[Required]
public string Name { get; set; }
/// <summary>
/// Publisher
/// </summary>
public virtual Publisher Publisher { get; set; }
}
42 changes: 30 additions & 12 deletions BervProject.WebApi.Boilerplate/Entities/Note.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,36 @@
namespace BervProject.WebApi.Boilerplate.Entities;

using System;
using Azure;
using Azure.Data.Tables;

namespace BervProject.WebApi.Boilerplate.Entities
/// <summary>
/// Note
/// </summary>
public class Note : ITableEntity
{
public class Note : ITableEntity
{
public string PartitionKey { get; set; }
public string RowKey { get; set; }
public string Title { get; set; }
public string Message { get; set; }
public DateTimeOffset? Timestamp { get; set; }
public ETag ETag { get; set; }
}
}

/// <summary>
/// Partition Key
/// </summary>
public string PartitionKey { get; set; }
/// <summary>
/// Row key
/// </summary>
public string RowKey { get; set; }
/// <summary>
/// Title
/// </summary>
public string Title { get; set; }
/// <summary>
/// Message
/// </summary>
public string Message { get; set; }
/// <summary>
/// Timestamp
/// </summary>
public DateTimeOffset? Timestamp { get; set; }
/// <summary>
/// ETag
/// </summary>
public ETag ETag { get; set; }
}
33 changes: 22 additions & 11 deletions BervProject.WebApi.Boilerplate/Entities/Publisher.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
using System;
namespace BervProject.WebApi.Boilerplate.Entities;

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;

namespace BervProject.WebApi.Boilerplate.Entities
/// <summary>
/// Publisher
/// </summary>
public class Publisher
{
public class Publisher
{
public Guid Id { get; set; }
[Required]
public string Name { get; set; }
[JsonIgnore]
public virtual ICollection<Book> Books { get; set; }
}
}
/// <summary>
/// Id
/// </summary>
public Guid Id { get; set; }
/// <summary>
/// Name
/// </summary>
[Required]
public string Name { get; set; }
/// <summary>
/// Books
/// </summary>
[JsonIgnore]
public virtual ICollection<Book> Books { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,41 @@

namespace BervProject.WebApi.Boilerplate.EntityFramework
{
/// <summary>
/// DB Context
/// </summary>
public class BoilerplateDbContext : DbContext
{
/// <summary>
/// Books
/// </summary>
public DbSet<Book> Books { get; set; }
/// <summary>
/// Publishers
/// </summary>
public DbSet<Publisher> Publishers { get; set; }

/// <summary>
/// Default Constructor
/// </summary>
public BoilerplateDbContext() : base()
{

}

/// <summary>
/// Constructor with DbContextOptions
/// </summary>
/// <param name="options">DbContextOptions</param>
public BoilerplateDbContext(DbContextOptions options) : base(options)
{

}

/// <summary>
/// Adding relationship
/// </summary>
/// <param name="modelBuilder"></param>
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
Expand Down
Loading
Loading