WIP cozy
This commit is contained in:
parent
91da89a4e8
commit
a15cc00595
4 changed files with 20 additions and 36 deletions
|
|
@ -3,25 +3,17 @@ using PlanTempus.Core.Sql;
|
|||
|
||||
namespace PlanTempus.Components.Organizations.Create
|
||||
{
|
||||
public class CreateOrganizationHandler
|
||||
public class CreateOrganizationHandler(IDatabaseOperations databaseOperations)
|
||||
{
|
||||
private readonly IDatabaseOperations _databaseOperations;
|
||||
|
||||
public CreateOrganizationHandler(IDatabaseOperations databaseOperations)
|
||||
{
|
||||
_databaseOperations = databaseOperations;
|
||||
}
|
||||
|
||||
public async Task<CreateOrganizationResult> Handle(CreateOrganizationCommand command)
|
||||
{
|
||||
using var db = _databaseOperations.CreateScope(nameof(CreateOrganizationHandler));
|
||||
using var db = databaseOperations.CreateScope(nameof(CreateOrganizationHandler));
|
||||
|
||||
try
|
||||
{
|
||||
var sql = @"
|
||||
INSERT INTO organizations (connection_string, created_by)
|
||||
VALUES (@ConnectionString, @CreatedBy)
|
||||
RETURNING id, created_at";
|
||||
var sql = @"INSERT INTO organizations (connection_string, created_by)
|
||||
VALUES (@ConnectionString, @CreatedBy)
|
||||
RETURNING id, created_at";
|
||||
|
||||
|
||||
var data = await db.Connection.QuerySqlAsync<CreateOrganizationResult>(sql, new
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue