Commit 31f4997e authored by Lorenzo Trujillo Rojas's avatar Lorenzo Trujillo Rojas
Browse files

Merge branch 'main' into 'main'

Se agrega footer y lista de administradores

See merge request ltrpro/pueblosmagicosconia!70
parents acbb85e1 3f5c2381
Loading
Loading
Loading
Loading
+17 −3
Original line number Diff line number Diff line
import { Controller, Get, Req, UseGuards } from '@nestjs/common';
import { Controller, Get, Param, Req, UseGuards } from '@nestjs/common';
import { AdminService } from './admin.service';
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
import { ADMIN_ROLES } from 'src/shared/enum/admin-role.enum';
import { ApiBearerAuth, ApiParam, ApiTags } from '@nestjs/swagger';
import { ADMIN_ROLES, SUPERADMIN_ROLES } from 'src/shared/enum/admin-role.enum';
import { Roles } from 'src/auth/role.decorator';
import { CustomAdminRequest } from 'src/auth/admin/interface/customAdminReq';
import { AuthAdminGuard } from 'src/auth/admin/authAdmin.guard';
@@ -24,4 +24,18 @@ export class AdminController {
      idTown: req.admin?.idTown?.townId || null,
    };
  }

  @UseGuards(AuthAdminGuard)
  @Roles(SUPERADMIN_ROLES)
  @ApiParam({ name: 'idTown', type: Number })
  @Get('admin/:idTown')
  @ApiBearerAuth('jwt')
  async findAllByTown(@Param('idTown') idTown: number) {
    try {
      const admins = await this.adminService.findAllByTown(idTown);
      return admins;
    } catch (e) {
      return e;
    }
  }
}
+19 −0
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ import { Repository } from 'typeorm';
import { InjectRepository } from '@nestjs/typeorm';
import { Town } from 'src/town/entities/town.entity';
import { ADMIN_ROLE } from 'src/shared/enum/admin-role.enum';
import { GetAdminDto } from './dto/get-admin.dto';

@Injectable()
export class AdminService {
@@ -31,4 +32,22 @@ export class AdminService {
  async updatePassword(email: string, password: string) {
    await this.adminRepository.update({ email }, { password });
  }

  async findAllByTown(idTown : number) : Promise<GetAdminDto[]> {
    const res: any[] = await this.adminRepository
      .createQueryBuilder('admin')
      .leftJoinAndSelect('admin.idTown', 'town')
      .where('admin.idTown = :idTown', { idTown: idTown })
      .getMany();
    const admins: GetAdminDto[] = res.map((admin) :GetAdminDto => {
      return {
        email: admin.email,
        idTown: admin.idTown.townId,
        name: admin.name,
        lastName: admin.lastName,
        status: admin.status
      };
    });
    return admins;
  }
}
+18 −0
Original line number Diff line number Diff line
import { ApiProperty } from "@nestjs/swagger";

export class GetAdminDto {
  @ApiProperty()
  email: string;

  @ApiProperty()
  idTown: number;

  @ApiProperty()
  name: string;

  @ApiProperty()
  lastName: string;

  @ApiProperty()
  status: string;
}
 No newline at end of file
+39 −0
Original line number Diff line number Diff line
.footer{
  display: flex;
  height: 100%;
  width: 100%;
  align-items: center;
  flex-wrap: wrap;
  padding: 1em;
}

.footer_license ,
.footer_developers{
  display: flex;
  flex-direction: column;
}

.footer_license{
  margin-top: auto;
}

.footer_credits{
  height: 100%;
}

.footer_icons{
  height: 50%;
  margin-left: auto;
}

.footer_images{
  height: 100%;
  display: flex;
  align-items: center;
}

.footer_images img{
  height: 100%;
  width: 100%;
  object-fit: contain;
}
 No newline at end of file
+70 −0
Original line number Diff line number Diff line
import './assets/css/styles.css';

interface Developer{
  name: string;
  lastName: string;
  role: string;
  linkedInURL: string;
}

export const Footer = () => {
  const style: React.CSSProperties = {
    fontSize: 11, 
    textDecoration: 'none', 
    color: 'black',
    textAlign: 'left'
  }

  const developers: Developer[] = [
    {
      name: 'Lorenzo',
      lastName: 'Trujillo',
      role: 'Desarrollador FrontEnd Mobile',
      linkedInURL: 'https://www.linkedin.com/in/lorenzotrujillorojassd/'
    },
    {
      name: 'Diego I.',
      lastName: 'Correa',
      role: 'Desarrollador BackEnd',
      linkedInURL: 'https://www.linkedin.com/in/diego-ivan-correa/'
    },
    {
      name: 'Omar',
      lastName: 'Luna',
      role: 'Desarrollador FrontEnd Web',
      linkedInURL: 'https://www.linkedin.com/in/omar-luna-hern%C3%A1ndez-a280ba267/'
    }
  ]

  return (
    <div className="footer">
      <div className='footer_credits'>
        <div className='footer_license'>
          <div style={style}>
            ©2024
            <a href='https://labsol.cozcyt.gob.mx/' style={style}> Labsol Network.</a>
          </div>
          <a href='https://www.gnu.org/licenses/gpl-3.0.html' style={style}>Bajo licencia GPL v.3.</a>
        </div>
        <div className='footer_developers'>
          {
            developers.map((dev) => {
              return (
                <a style={style} href={dev.linkedInURL}>@ {dev.name + ' ' + dev.lastName + ' (' + dev.role +')'}</a>
              );
            })
          }
        </div>
      </div>

      <div className='footer_icons'>
        <div className='footer_images'>
          <img src='https://sit.cozcyt.gob.mx/static/images/sit_logo_texto_lab.png?v=2' 
            title="Laboratorio de Software Libre Network"/>
          <img src='https://sit.cozcyt.gob.mx/static/images/sit_logo_licencia.png?v=2' 
            title='GNU General Public License v.3.'/>
        </div>
      </div>
    </div>
  );
}
 No newline at end of file
Loading