Skip to content

Instantly share code, notes, and snippets.

View pazteddy's full-sized avatar
🏠
Working from home

Teddy Paz Muñoz pazteddy

🏠
Working from home
View GitHub Profile
@pazteddy
pazteddy / Instalaciones-arquitectura-limpia.md
Created November 20, 2025 15:12
Instalaciones recomendadas - .NET: Pruebas completas para minimal API

Instalaciones recomendadas - .NET: Pruebas completas para minimal API

.NET Logo xUnit Logo

@pazteddy
pazteddy / deploy-aws-eb-guide.md
Last active October 28, 2025 21:22
Pasos para desplegar nuestra aplicación en AWS Elastic Beanstalk

Guía de despliegue en AWS Elastic Beanstalk

Esta guía documenta el proceso completo para desplegar la aplicación TechNotes en AWS Elastic Beanstalk, basada en el despliegue exitoso realizado.

Requisitos previos

  • Shell zsh
  • .NET SDK 8 instalado (dotnet --version)
  • EB CLI instalado (eb --version)
@pazteddy
pazteddy / NoteOverview.razor
Created October 22, 2025 17:25
Estilos para la última columna de acciones en el componente NoteOverview
<TemplateColumn Title="Acciones" Class="border-2 px-6 py-4 text-center">
<div class="flex items-center justify-center space-x-2">
<button @onclick="() => EditNote(context.Id)"
class="p-2 text-indigo-600 hover:text-indigo-900 rounded-full hover:bg-indigo-50">
<svg class="w-4 h-4" fill="currentColor" viewBox="0 0 16 16">
<path
d="M12.854.146a.5.5 0 0 0-.707 0L10.5 1.793 14.207 5.5l1.647-1.646a.5.5 0 0 0 0-.708l-3-3zm.646 6.061L9.793 2.5 3.293 9H3.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.207l6.5-6.5zm-7.468 7.468A.5.5 0 0 1 6 13.5V13h-.5a.5.5 0 0 1-.5-.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.5-.5V10h-.5a.499.499 0 0 1-.175-.032l-.179.178a.5.5 0 0 0-.11.168l-2 5a.5.5 0 0 0 .65.65l5-2a.5.5 0 0 0 .168-.11l.178-.178z" />
</svg>
</button>
<button @onclick="() => TogglePublishNote(context.Id)"
@pazteddy
pazteddy / NoteOverview.razor
Last active October 22, 2025 16:57
Estilos para el componente NoteOverview
@page "/note-overview"
@using TechNotes.Application.Notes
@rendermode @(new InteractiveWebAssemblyRenderMode(false))
@inject HttpClient Http
@inject NavigationManager NavigationManager
<PageTitle>Mis notas</PageTitle>
<h2 class="text-5xl font-bold text-center mb-3">Mis notas</h2>
@if (notes == null)
@pazteddy
pazteddy / RemoveRoleFromUser.cs
Last active October 17, 2025 21:36
Instrucciones para la tarea de eliminar un rol
/*
=============
🏆 Ejercicio
=============
*/
// 1. Agregar el siguiente método a la interfaz IUserService:
//
// - RemoveRoleFromUserAsync
// → Recibe un userId y un roleName,
// y elimina el rol del usuario indicado de forma asíncrona.
@pazteddy
pazteddy / UserRolesModal.razor
Last active October 17, 2025 15:39
Modal para la gestión de roles
@if (ShowModal)
{
<div class="fixed inset-0 z-50 flex items-center justify-center bg-black/40">
<div class="relative w-full max-w-lg sm:max-w-xl bg-white rounded-xl shadow-xl p-4 sm:p-5">
<!-- Boton de cerrar esquina superior derecha -->
<button @onclick="CloseModal"
class="absolute top-3 right-3 inline-flex items-center justify-center w-8 h-8 rounded-full text-gray-500 hover:text-gray-700 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500">
<svg class="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
@pazteddy
pazteddy / UserOverview.razor
Created October 16, 2025 20:10
Estilos para el botón para manejo de roles y línea de comando para Tailwind
<TemplateColumn Title="Administrar" Class="border-2 px-4 py-3 text-center">
<div class="flex justify-center">
<button
class="rounded-md inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-all duration-200 shadow-sm hover:shadow-md"
@onclick="() => OpenModal(context.Id, context.UserName)">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756
@pazteddy
pazteddy / NoteLayout.razor
Created October 15, 2025 00:45
Enlace con estilos para navegar al componente user-overview
<AuthorizeView Roles="Admin" Context="adminContext">
<Authorized>
<li class="flex">
<a rel="noopener noreferrer" href="/user-overview"
class="flex items-center px-4 -mb-1 border-b-2 dark:border- hover:dark:text-violet-600 hover:dark:border-violet-600 transition-colors">
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor"
viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round"
stroke-width="2"
d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.
@pazteddy
pazteddy / Consultas.sql
Last active October 10, 2025 19:39
Componente razor para mostrar detalle de nota, pie de nota con el enlace de editar solo para Admin y Writer y consultas para asignar un usuario con el rol Admin
-- 🔍 Consulta para obtener la lista de usuarios junto con los roles que tienen asignados
-- Esta consulta realiza un JOIN entre las tablas de usuarios, roles y asignaciones (AspNetUserRoles)
SELECT [UserId], -- ID del usuario
[UserName], -- Nombre de usuario
[RoleId], -- ID del rol asignado
[Name] AS RoleName -- Nombre legible del rol
FROM [TechNotesDb].[dbo].[AspNetUserRoles] ur
JOIN [TechNotesDb].[dbo].[AspNetUsers] u ON ur.UserId = u.Id
JOIN [TechNotesDb].[dbo].[AspNetRoles] r ON ur.RoleId = r.Id
@pazteddy
pazteddy / LoginUser.razor
Last active October 7, 2025 20:10
Adicionar botón para registrarse e iniciar sesión con Google
<button type="submit"
class="block w-full rounded-lg bg-indigo-600 px-5 py-3 text-sm font-medium text-white hover:bg-indigo-700 focus:outline-none focus:ring focus:ring-indigo-300 active:bg-indigo-800 transition-colors">
Inicio de sesión
</button>
</EditForm>
<!-- Divisor -->
<div class="mt-6 mb-6">
<div class="relative">
<div class="absolute inset-0 flex items-center">