From b7e39b59fd0fc7b5610ebff29035bf622079e0d8 Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Wed, 5 Oct 2022 20:45:21 +0800 Subject: refactor: Change file structure --- .../Internal/Account/CreateInitialAccountRoute.cs | 34 ---------------------- 1 file changed, 34 deletions(-) delete mode 100644 server/src/Endpoints/Internal/Account/CreateInitialAccountRoute.cs (limited to 'server/src/Endpoints/Internal/Account/CreateInitialAccountRoute.cs') diff --git a/server/src/Endpoints/Internal/Account/CreateInitialAccountRoute.cs b/server/src/Endpoints/Internal/Account/CreateInitialAccountRoute.cs deleted file mode 100644 index 13fbdf4..0000000 --- a/server/src/Endpoints/Internal/Account/CreateInitialAccountRoute.cs +++ /dev/null @@ -1,34 +0,0 @@ -namespace IOL.GreatOffice.Api.Endpoints.Internal.Account; - -/// -public class CreateInitialAccountRoute : RouteBaseAsync.WithoutRequest.WithActionResult -{ - private readonly AppDbContext _context; - private readonly UserService _userService; - - /// - public CreateInitialAccountRoute(AppDbContext context, UserService userService) { - _context = context; - _userService = userService; - } - - /// - /// Create an initial user account. - /// - /// - /// - [AllowAnonymous] - [HttpGet("~/_/account/create-initial")] - public override async Task HandleAsync(CancellationToken cancellationToken = default) { - if (_context.Users.Any()) { - return NotFound(); - } - - var user = new User("admin@ivarlovlie.no"); - user.HashAndSetPassword("ivar123"); - _context.Users.Add(user); - await _context.SaveChangesAsync(cancellationToken); - await _userService.LogInUser(HttpContext, user); - return Redirect("/"); - } -} -- cgit v1.3