Add global usings

This commit is contained in:
Kasper Juul Hermansen 2021-11-11 21:54:11 +01:00
parent 2e737359c7
commit 43a9187579
Signed by: kjuulh
GPG Key ID: 0F95C140730F2F23
8 changed files with 14 additions and 25 deletions

View File

@ -1,8 +1,6 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Todo.Core.Entities;
using Todo.Core.Interfaces.Persistence; using Todo.Core.Interfaces.Persistence;
namespace Todo.Api.Controllers namespace Todo.Api.Controllers
@ -20,12 +18,6 @@ namespace Todo.Api.Controllers
_userRepository = userRepository; _userRepository = userRepository;
} }
public record RegisterUserRequest
{
[Required] public string Email { get; init; }
[Required] public string Password { get; init; }
}
[HttpPost("register")] [HttpPost("register")]
public async Task<IActionResult> Register([FromBody] RegisterUserRequest request) public async Task<IActionResult> Register([FromBody] RegisterUserRequest request)
{ {
@ -33,5 +25,11 @@ namespace Todo.Api.Controllers
return Ok(user); return Ok(user);
} }
public record RegisterUserRequest
{
[Required] public string Email { get; init; }
[Required] public string Password { get; init; }
}
} }
} }

View File

@ -1,6 +1,4 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Todo.Core.Interfaces.Persistence; using Todo.Core.Interfaces.Persistence;
@ -17,11 +15,6 @@ public class TodosController : ControllerBase
_todoRepository = todoRepository; _todoRepository = todoRepository;
} }
public record CreateTodoRequest
{
[Required] public string Title { get; init; }
}
[HttpPost] [HttpPost]
public async Task<ActionResult<Core.Entities.Todo>> CreateTodo([FromBody] CreateTodoRequest request) public async Task<ActionResult<Core.Entities.Todo>> CreateTodo([FromBody] CreateTodoRequest request)
{ {
@ -37,4 +30,9 @@ public class TodosController : ControllerBase
return Ok(todos); return Ok(todos);
} }
public record CreateTodoRequest
{
[Required] public string Title { get; init; }
}
} }

View File

@ -1,6 +1,4 @@
using System;
using System.Text.Json; using System.Text.Json;
using System.Threading.Tasks;
using Microsoft.AspNetCore.SignalR; using Microsoft.AspNetCore.SignalR;
using Todo.Core.Interfaces.Persistence; using Todo.Core.Interfaces.Persistence;
@ -14,7 +12,7 @@ namespace Todo.Api.Hubs
{ {
_todoRepository = todoRepository; _todoRepository = todoRepository;
} }
public async Task GetInboxTodos() public async Task GetInboxTodos()
{ {
await Clients.Caller.SendAsync("InboxTodos", "some data"); await Clients.Caller.SendAsync("InboxTodos", "some data");

View File

@ -1,4 +1,3 @@
namespace Todo.Core.Interfaces.Persistence; namespace Todo.Core.Interfaces.Persistence;
public interface ITodoRepository public interface ITodoRepository

View File

@ -1,5 +1,7 @@
global using System; global using System;
global using System.Threading.Tasks; global using System.Threading.Tasks;
global using System.Linq;
global using System.Collections.Generic;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Todo.Core.Interfaces.Persistence; using Todo.Core.Interfaces.Persistence;
using Todo.Persistence.Mongo.Repositories; using Todo.Persistence.Mongo.Repositories;

View File

@ -1,5 +1,3 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using MongoDB.Driver; using MongoDB.Driver;
using Todo.Persistence.Mongo.Repositories.Dtos; using Todo.Persistence.Mongo.Repositories.Dtos;

View File

@ -1,6 +1,3 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using MongoDB.Driver; using MongoDB.Driver;
using Todo.Core.Interfaces.Persistence; using Todo.Core.Interfaces.Persistence;
using Todo.Persistence.Mongo.Repositories.Dtos; using Todo.Persistence.Mongo.Repositories.Dtos;

View File

@ -1,4 +1,3 @@
using System.Threading.Tasks;
using MongoDB.Driver; using MongoDB.Driver;
using Todo.Core.Entities; using Todo.Core.Entities;
using Todo.Core.Interfaces.Persistence; using Todo.Core.Interfaces.Persistence;