Skip to content

Instantly share code, notes, and snippets.

View rafaeldalsenter's full-sized avatar
🚀

Rafael Dalsenter rafaeldalsenter

🚀
  • Brazil
View GitHub Profile
public static void RegisterServices(IServiceCollection services, IConfiguration configuration)
{
...
services.AddScoped<IRequestHandler<CreateClienteCommand, CommandReturnDto>, CreateClienteCommandHandler>();
services.AddScoped<IRequestHandler<RemoveClienteCommand, CommandReturnDto>, RemoveClienteCommandHandler>();
services.AddScoped<IRequestHandler<UpdateClienteCommand, CommandReturnDto>, UpdateClienteCommandHandler>();
}
public class CreateClienteCommandHandler : IRequestHandler<CreateClienteCommand, CommandReturnDto>
{
public CreateClienteCommandHandler(/*Repositories por injeção de dependência*/)
{
}
public Task<CommandReturnDto> Handle(CreateClienteCommand request, CancellationToken cancellationToken)
{
// Insere nos bancos de dados e retorna o CommandReturnDto
}
public class CreateClienteCommand : IRequest<CommandReturnDto>
{
public string Nome { get; private set; }
public string Cpf { get; private set; }
public string Rua { get; private set; }
public string Bairro { get; private set; }
public string Cidade { get; private set; }
public string Observacoes { get; private set; }
public CreateClienteCommand(string nome, string cpf, string rua, string bairro, string cidade, string obs)
{
"ConnectionStrings": {
"DefaultConnection": "Host=localhost;Port=5432;Database=postgres;User ID=postgres;Password=postgres",
"MongoConnection": "mongodb://root:root@localhost:27017"
}
}
version: '3'
services:
db-postgres:
image: postgres
container_name: db-postgres
environment:
POSTGRES_PASSWORD: "postgres"
ports:
- "5432:5432"
name: Lambda deploy
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
link = aws_ext.link_from_object(bucketNameDest, archiveNameDest)
return function_return(True, "Bucket successfully compressed!", link)
aws_ext.delete_object_if_exists(bucketNameDest, archiveNameDest)
binary = BytesIO()
for page in objects.page_size(amount_objects).pages():
zip_file = aws_ext.get_object_summary(bucketNameDest, archiveNameDest)
print("Upload +{} files to {}...".format(amount_objects, archiveNameDest))
print('Source Bucket:', bucketNameSource)
print('Target archive:', bucketNameDest + '/' + archiveNameDest)
objects = aws_ext.all_objects_from_bucket(bucketNameSource)
count_objects = aws_ext.count_objects(objects)
amount_objects = amountOfFilesToUpload
if(amount_objects == 0):
amount_objects = count_objects
def lambda_handler(event, context):
try:
print('Started the Lambda function')
bucketNameSource = event['bucket_name_source']
bucketNameDest = event['bucket_name_dest']
archiveNameDest = event['archive_name_dest']
archivePublicAccess = event['archive_public_access']
amountOfFilesToUpload = event['amount_of_files_to_upload']