Merge branch 'dev' into US-listarInquilinos
This commit is contained in:
commit
06084ed899
|
@ -5,30 +5,46 @@ name: Node.js CI
|
|||
|
||||
on:
|
||||
push:
|
||||
branches: ['master']
|
||||
branches: ['master', 'dev']
|
||||
pull_request:
|
||||
branches: ['master']
|
||||
branches: ['master', 'dev']
|
||||
|
||||
jobs:
|
||||
build:
|
||||
build-api:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./mobile-ui
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [14.x, 16.x, 18.x]
|
||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
run: cd ./mobile-ui
|
||||
- name: checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
cache: 'npm'
|
||||
- name: Test
|
||||
run: |
|
||||
cd ./api-gateway
|
||||
npm ci
|
||||
npm run build --if-present
|
||||
npm test
|
||||
build-web:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [14.x, 16.x, 18.x]
|
||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
cache: 'npm'
|
||||
- name: Test
|
||||
run: |
|
||||
cd ./web-ui/web-react/
|
||||
npm ci
|
||||
npm run build --if-present
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"editorconfig": false,
|
||||
"indent_size": 2,
|
||||
"end_with_newline": true,
|
||||
"html": {
|
||||
"brace_style": "collapse",
|
||||
"indent_char": " ",
|
||||
"indent_scripts": "normal",
|
||||
"indent_inner_html": true,
|
||||
"indent_empty_lines": false,
|
||||
"wrap_line_length": 120,
|
||||
"wrap_attributes": "force-expand-multiline",
|
||||
"unformatted": [
|
||||
"sub",
|
||||
"sup",
|
||||
"b",
|
||||
"i",
|
||||
"u",
|
||||
"em",
|
||||
"strong"
|
||||
],
|
||||
"preserve_newlines": true,
|
||||
"max_preserve_newlines": 2
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
node_modules/*
|
||||
e2e/*
|
||||
dist/*
|
||||
src/assets/scss/bootstrap/*
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"printWidth": 80,
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "all",
|
||||
"bracketSpacing": true,
|
||||
"arrowParens": "always",
|
||||
"jsxBracketSameLine": false,
|
||||
"semi": true
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
import { Controller, Get, Post, Body, Param, Delete } from '@nestjs/common';
|
||||
import { AppService } from "./app.service";
|
||||
import { AppService } from './app.service';
|
||||
@Controller()
|
||||
export class AppController {
|
||||
constructor(private readonly appService: AppService) { }
|
||||
constructor(private readonly appService: AppService) {}
|
||||
// #==== API Users
|
||||
@Post('user/createAdminSystem')
|
||||
createAdminSystem(
|
||||
|
@ -11,13 +11,12 @@ export class AppController {
|
|||
@Body('last_name') last_name: string,
|
||||
@Body('email') email: string,
|
||||
@Body('phone') phone: number,
|
||||
@Body('password') password: string,
|
||||
@Body('user_type') user_type: string,
|
||||
@Body('status') status: string,
|
||||
@Body('date_entry') date_entry: Date,
|
||||
) {
|
||||
return this.appService.createAdminSystem(dni, name, last_name, email, phone, password,
|
||||
user_type, status, date_entry);
|
||||
return this.appService.createAdminSystem(dni, name, last_name, email, phone,
|
||||
user_type, status, date_entry);
|
||||
}
|
||||
|
||||
@Post('user/createGuard')
|
||||
|
@ -28,13 +27,29 @@ export class AppController {
|
|||
@Body('last_name') last_name: string,
|
||||
@Body('email') email: string,
|
||||
@Body('phone') phone: number,
|
||||
@Body('password') password: string,
|
||||
@Body('user_type') user_type: string,
|
||||
@Body('status') status: string,
|
||||
@Body('date_entry') date_entry: Date,
|
||||
@Body('community_id') community_id: string,
|
||||
) {
|
||||
return this.appService.createGuard(dni, name, last_name, email, phone,
|
||||
user_type, status, date_entry,community_id);
|
||||
}
|
||||
|
||||
@Post('user/createAdminCommunity')
|
||||
createAdminCommunity(
|
||||
//Nombre, Apellidos, Correo electrónico, Cédula, Teléfono, Contraseña
|
||||
@Body('dni') dni: string,
|
||||
@Body('name') name: string,
|
||||
@Body('last_name') last_name: string,
|
||||
@Body('email') email: string,
|
||||
@Body('phone') phone: number,
|
||||
@Body('user_type') user_type: string,
|
||||
@Body('status') status: string,
|
||||
@Body('date_entry') date_entry: Date,
|
||||
@Body('community_id') community_id:string
|
||||
) {
|
||||
return this.appService.createGuard(dni, name, last_name, email, phone, password,
|
||||
return this.appService.createAdminCommunity(dni, name, last_name, email, phone,
|
||||
user_type, status, date_entry,community_id);
|
||||
}
|
||||
|
||||
|
@ -51,8 +66,18 @@ export class AppController {
|
|||
@Body('date_entry') date_entry: Date,
|
||||
@Body('community_id') community_id: string,
|
||||
) {
|
||||
return this.appService.createUser(dni, name, last_name, email, phone, password,
|
||||
user_type, status, date_entry, community_id);
|
||||
return this.appService.createUser(
|
||||
dni,
|
||||
name,
|
||||
last_name,
|
||||
email,
|
||||
phone,
|
||||
password,
|
||||
user_type,
|
||||
status,
|
||||
date_entry,
|
||||
community_id,
|
||||
);
|
||||
}
|
||||
|
||||
@Get('user/allUsers')
|
||||
|
@ -65,7 +90,7 @@ export class AppController {
|
|||
@Body('email') pEmail: string,
|
||||
@Body('password') pPassword: string,
|
||||
) {
|
||||
return this.appService.inicioSesion(pEmail,pPassword);
|
||||
return this.appService.inicioSesion(pEmail, pPassword);
|
||||
}
|
||||
|
||||
@Get('user/findAdminSistema')
|
||||
|
@ -79,9 +104,7 @@ export class AppController {
|
|||
}
|
||||
|
||||
@Get('user/findGuards/:community')
|
||||
findGuardsCommunity(
|
||||
@Param('community_id') community_id: string
|
||||
) {
|
||||
findGuardsCommunity(@Param('community_id') community_id: string) {
|
||||
return this.appService.findGuardsCommunity(community_id);
|
||||
}
|
||||
|
||||
|
@ -91,17 +114,12 @@ export class AppController {
|
|||
}
|
||||
|
||||
@Get('user/find/:dni')
|
||||
findUser(
|
||||
@Param('dni') paramUserDNI: string
|
||||
) {
|
||||
findUser(@Param('dni') paramUserDNI: string) {
|
||||
return this.appService.findUser(paramUserDNI);
|
||||
}
|
||||
|
||||
|
||||
@Delete('user/deleteAdminSystem/:id')
|
||||
deleteAdminSystem(
|
||||
@Param('id') id: string,
|
||||
) {
|
||||
deleteAdminSystem(@Param('id') id: string) {
|
||||
return this.appService.deleteAdminSystem(id);
|
||||
}
|
||||
|
||||
|
@ -117,11 +135,18 @@ export class AppController {
|
|||
@Body('status') status: string,
|
||||
@Body('date_entry') date_entry: Date,
|
||||
@Body('houses') houses: [],
|
||||
|
||||
) {
|
||||
return this.appService.createCommunity(name, province, canton,
|
||||
district, num_houses, phone,
|
||||
status, date_entry, houses);
|
||||
return this.appService.createCommunity(
|
||||
name,
|
||||
province,
|
||||
canton,
|
||||
district,
|
||||
num_houses,
|
||||
phone,
|
||||
status,
|
||||
date_entry,
|
||||
houses,
|
||||
);
|
||||
}
|
||||
|
||||
@Get('community/allCommunities')
|
||||
|
@ -130,25 +155,17 @@ export class AppController {
|
|||
}
|
||||
|
||||
@Get('community/findCommunity/:id')
|
||||
findCommunity(
|
||||
@Param('id') paramCommunityId: string
|
||||
) {
|
||||
findCommunity(@Param('id') paramCommunityId: string) {
|
||||
return this.appService.findCommunity(paramCommunityId);
|
||||
}
|
||||
|
||||
@Get('community/findCommunityName/:id')
|
||||
findCommunityName(
|
||||
@Param('id') paramCommunityId: string
|
||||
) {
|
||||
findCommunityName(@Param('id') paramCommunityId: string) {
|
||||
return this.appService.findCommunityName(paramCommunityId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Post('community/findCommunityAdmin')
|
||||
findCommunityAdmin(
|
||||
@Body('community_id') community_id: string,
|
||||
) {
|
||||
findCommunityAdmin(@Body('community_id') community_id: string) {
|
||||
return this.appService.findCommunityAdmin(community_id);
|
||||
}
|
||||
|
||||
|
@ -161,22 +178,22 @@ export class AppController {
|
|||
@Body('bookable') bookable: number,
|
||||
@Body('community_id') community_id: string,
|
||||
) {
|
||||
|
||||
return this.appService.createCommonArea(name, hourMin, hourMax,
|
||||
bookable, community_id);
|
||||
return this.appService.createCommonArea(
|
||||
name,
|
||||
hourMin,
|
||||
hourMax,
|
||||
bookable,
|
||||
community_id,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@Get('commonArea/allCommonAreas')
|
||||
allCommonAreas() {
|
||||
return this.appService.allCommonAreas();
|
||||
}
|
||||
|
||||
|
||||
@Get('commonArea/findCommonArea/:id')
|
||||
findCommonArea(
|
||||
@Param('id') paramCommonAreaId: string
|
||||
) {
|
||||
findCommonArea(@Param('id') paramCommonAreaId: string) {
|
||||
return this.appService.findCommonArea(paramCommonAreaId);
|
||||
}
|
||||
|
||||
|
@ -192,7 +209,15 @@ export class AppController {
|
|||
@Body('status') status: string,
|
||||
@Body('date_entry') date_entry: Date,
|
||||
) {
|
||||
return this.appService.createGuest(name, last_name, dni, number_plate, phone, status, date_entry);
|
||||
return this.appService.createGuest(
|
||||
name,
|
||||
last_name,
|
||||
dni,
|
||||
number_plate,
|
||||
phone,
|
||||
status,
|
||||
date_entry,
|
||||
);
|
||||
}
|
||||
|
||||
@Get('guest/allGuests')
|
||||
|
@ -201,13 +226,10 @@ export class AppController {
|
|||
}
|
||||
|
||||
@Get('guest/find/:dni')
|
||||
findGuest(
|
||||
@Param('dni') paramGuestDNI: string
|
||||
) {
|
||||
findGuest(@Param('dni') paramGuestDNI: string) {
|
||||
return this.appService.findGuest(paramGuestDNI);
|
||||
}
|
||||
|
||||
|
||||
// #==== API Payment
|
||||
|
||||
@Post('payment/createPayment')
|
||||
|
@ -220,8 +242,15 @@ export class AppController {
|
|||
@Body('user_id') user_id: string,
|
||||
@Body('communty_id') communty_id: string,
|
||||
) {
|
||||
return this.appService.createPayment(date_payment, mount, description,
|
||||
period, status, user_id, communty_id);
|
||||
return this.appService.createPayment(
|
||||
date_payment,
|
||||
mount,
|
||||
description,
|
||||
period,
|
||||
status,
|
||||
user_id,
|
||||
communty_id,
|
||||
);
|
||||
}
|
||||
|
||||
@Get('payment/allPayments')
|
||||
|
@ -230,9 +259,7 @@ export class AppController {
|
|||
}
|
||||
|
||||
@Get('payment/find/:dni')
|
||||
findPayment(
|
||||
@Param('dni') paramPaymentDNI: string
|
||||
) {
|
||||
findPayment(@Param('dni') paramPaymentDNI: string) {
|
||||
return this.appService.findPayment(paramPaymentDNI);
|
||||
}
|
||||
|
||||
|
@ -247,8 +274,14 @@ export class AppController {
|
|||
@Body('user_id') user_id: string,
|
||||
@Body('common_area_id') common_area_id: string,
|
||||
) {
|
||||
return this.appService.createReservation(start_time, finish_time, status,
|
||||
date_entry, user_id, common_area_id);
|
||||
return this.appService.createReservation(
|
||||
start_time,
|
||||
finish_time,
|
||||
status,
|
||||
date_entry,
|
||||
user_id,
|
||||
common_area_id,
|
||||
);
|
||||
}
|
||||
|
||||
@Get('reservation/allReservations')
|
||||
|
@ -257,13 +290,10 @@ export class AppController {
|
|||
}
|
||||
|
||||
@Get('reservation/find/:id')
|
||||
findReservation(
|
||||
@Param('id') paramReservation: string
|
||||
) {
|
||||
findReservation(@Param('id') paramReservation: string) {
|
||||
return this.appService.findReservation(paramReservation);
|
||||
}
|
||||
|
||||
|
||||
// #==== API Post
|
||||
|
||||
@Post('post/createPost')
|
||||
|
@ -282,13 +312,10 @@ export class AppController {
|
|||
}
|
||||
|
||||
@Get('post/find/:id')
|
||||
findPost(
|
||||
@Param('id') paramPost: string
|
||||
) {
|
||||
findPost(@Param('id') paramPost: string) {
|
||||
return this.appService.findPost(paramPost);
|
||||
}
|
||||
|
||||
|
||||
// #==== API Comment
|
||||
|
||||
@Post('post/createComment')
|
||||
|
@ -307,14 +334,10 @@ export class AppController {
|
|||
}
|
||||
|
||||
@Get('post/findComment/:id')
|
||||
findComment(
|
||||
@Param('id') paramComment: string
|
||||
) {
|
||||
findComment(@Param('id') paramComment: string) {
|
||||
return this.appService.findComment(paramComment);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// #==== API Report
|
||||
|
||||
@Post('report/createReport')
|
||||
|
@ -324,7 +347,12 @@ export class AppController {
|
|||
@Body('date_entry') date_entry: Date,
|
||||
@Body('user_id') user_id: string,
|
||||
) {
|
||||
return this.appService.createReport(action, description, date_entry, user_id);
|
||||
return this.appService.createReport(
|
||||
action,
|
||||
description,
|
||||
date_entry,
|
||||
user_id,
|
||||
);
|
||||
}
|
||||
|
||||
@Get('report/allReports')
|
||||
|
@ -333,26 +361,16 @@ export class AppController {
|
|||
}
|
||||
|
||||
@Get('report/find/:id')
|
||||
findReport(
|
||||
@Param('id') paramReport: string
|
||||
) {
|
||||
findReport(@Param('id') paramReport: string) {
|
||||
return this.appService.findReport(paramReport);
|
||||
}
|
||||
|
||||
|
||||
@Post('email/sendMail')
|
||||
senMail(
|
||||
@Body('email') email: string,
|
||||
) {
|
||||
|
||||
senMail(@Body('email') email: string) {
|
||||
return this.appService.sendMail(email);
|
||||
}
|
||||
@Post('email/html')
|
||||
html(
|
||||
@Body('email') email: string,
|
||||
@Body('name') name: string,
|
||||
) {
|
||||
|
||||
html(@Body('email') email: string, @Body('name') name: string) {
|
||||
return this.appService.html(email, name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,99 +1,99 @@
|
|||
import { Module } from '@nestjs/common';
|
||||
import { AppController } from './app.controller';
|
||||
import { ClientsModule, Transport } from "@nestjs/microservices";
|
||||
import { ClientsModule, Transport } from '@nestjs/microservices';
|
||||
import { AppService } from './app.service';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
ClientsModule.register([
|
||||
{
|
||||
name: "SERVICIO_USUARIOS",
|
||||
name: 'SERVICIO_USUARIOS',
|
||||
transport: Transport.TCP,
|
||||
options: {
|
||||
host: "127.0.0.1",
|
||||
port: 3001
|
||||
}
|
||||
}
|
||||
host: '127.0.0.1',
|
||||
port: 3001,
|
||||
},
|
||||
},
|
||||
]),
|
||||
ClientsModule.register([
|
||||
{
|
||||
name: "SERVICIO_COMUNIDADES",
|
||||
name: 'SERVICIO_COMUNIDADES',
|
||||
transport: Transport.TCP,
|
||||
options: {
|
||||
host: "127.0.0.1",
|
||||
port: 3002
|
||||
}
|
||||
}
|
||||
host: '127.0.0.1',
|
||||
port: 3002,
|
||||
},
|
||||
},
|
||||
]),
|
||||
ClientsModule.register([
|
||||
{
|
||||
name: "SERVICIO_AREAS_COMUNES",
|
||||
name: 'SERVICIO_AREAS_COMUNES',
|
||||
transport: Transport.TCP,
|
||||
options: {
|
||||
host: "127.0.0.1",
|
||||
port: 3003
|
||||
}
|
||||
}
|
||||
host: '127.0.0.1',
|
||||
port: 3003,
|
||||
},
|
||||
},
|
||||
]),
|
||||
ClientsModule.register([
|
||||
{
|
||||
name: "SERVICIO_INVITADOS",
|
||||
name: 'SERVICIO_INVITADOS',
|
||||
transport: Transport.TCP,
|
||||
options: {
|
||||
host: "127.0.0.1",
|
||||
port: 3004
|
||||
}
|
||||
}
|
||||
host: '127.0.0.1',
|
||||
port: 3004,
|
||||
},
|
||||
},
|
||||
]),
|
||||
ClientsModule.register([
|
||||
{
|
||||
name: "SERVICIO_PAGOS",
|
||||
name: 'SERVICIO_PAGOS',
|
||||
transport: Transport.TCP,
|
||||
options: {
|
||||
host: "127.0.0.1",
|
||||
port: 3005
|
||||
}
|
||||
}
|
||||
host: '127.0.0.1',
|
||||
port: 3005,
|
||||
},
|
||||
},
|
||||
]),
|
||||
ClientsModule.register([
|
||||
{
|
||||
name: "SERVICIO_RESERVACIONES",
|
||||
name: 'SERVICIO_RESERVACIONES',
|
||||
transport: Transport.TCP,
|
||||
options: {
|
||||
host: "127.0.0.1",
|
||||
port: 3006
|
||||
}
|
||||
}
|
||||
host: '127.0.0.1',
|
||||
port: 3006,
|
||||
},
|
||||
},
|
||||
]),
|
||||
ClientsModule.register([
|
||||
{
|
||||
name: "SERVICIO_POSTS",
|
||||
name: 'SERVICIO_POSTS',
|
||||
transport: Transport.TCP,
|
||||
options: {
|
||||
host: "127.0.0.1",
|
||||
port: 3007
|
||||
}
|
||||
}
|
||||
]),
|
||||
ClientsModule.register([
|
||||
{
|
||||
name: "SERVICIO_REPORTES",
|
||||
transport: Transport.TCP,
|
||||
options: {
|
||||
host: "127.0.0.1",
|
||||
port: 3008
|
||||
}
|
||||
}
|
||||
host: '127.0.0.1',
|
||||
port: 3007,
|
||||
},
|
||||
},
|
||||
]),
|
||||
ClientsModule.register([
|
||||
{
|
||||
name: "SERVICIO_NOTIFICACIONES",
|
||||
name: 'SERVICIO_REPORTES',
|
||||
transport: Transport.TCP,
|
||||
options: {
|
||||
host: "127.0.0.1",
|
||||
port: 3009
|
||||
}
|
||||
}
|
||||
host: '127.0.0.1',
|
||||
port: 3008,
|
||||
},
|
||||
},
|
||||
]),
|
||||
ClientsModule.register([
|
||||
{
|
||||
name: 'SERVICIO_NOTIFICACIONES',
|
||||
transport: Transport.TCP,
|
||||
options: {
|
||||
host: '127.0.0.1',
|
||||
port: 3009,
|
||||
},
|
||||
},
|
||||
]),
|
||||
],
|
||||
controllers: [AppController],
|
||||
|
|
|
@ -1,61 +1,91 @@
|
|||
import { Injectable, Inject } from '@nestjs/common';
|
||||
import { ClientProxy } from "@nestjs/microservices";
|
||||
import { map } from "rxjs/operators";
|
||||
|
||||
import { ClientProxy } from '@nestjs/microservices';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
@Injectable()
|
||||
export class AppService {
|
||||
constructor(
|
||||
@Inject('SERVICIO_USUARIOS') private readonly clientUserApp: ClientProxy,
|
||||
@Inject('SERVICIO_COMUNIDADES') private readonly clientCommunityApp: ClientProxy,
|
||||
@Inject('SERVICIO_AREAS_COMUNES') private readonly clientCommonAreaApp: ClientProxy,
|
||||
@Inject('SERVICIO_COMUNIDADES')
|
||||
private readonly clientCommunityApp: ClientProxy,
|
||||
@Inject('SERVICIO_AREAS_COMUNES')
|
||||
private readonly clientCommonAreaApp: ClientProxy,
|
||||
@Inject('SERVICIO_INVITADOS') private readonly clientGuestApp: ClientProxy,
|
||||
@Inject('SERVICIO_PAGOS') private readonly clientPaymentApp: ClientProxy,
|
||||
@Inject('SERVICIO_RESERVACIONES') private readonly clientReservationApp: ClientProxy,
|
||||
@Inject('SERVICIO_RESERVACIONES')
|
||||
private readonly clientReservationApp: ClientProxy,
|
||||
@Inject('SERVICIO_POSTS') private readonly clientPostApp: ClientProxy,
|
||||
@Inject('SERVICIO_REPORTES') private readonly clientReportApp: ClientProxy,
|
||||
@Inject('SERVICIO_NOTIFICACIONES') private readonly clientNotificationtApp: ClientProxy,
|
||||
) { }
|
||||
@Inject('SERVICIO_NOTIFICACIONES')
|
||||
private readonly clientNotificationtApp: ClientProxy,
|
||||
) {}
|
||||
|
||||
// ====================== USERS ===============================
|
||||
// ====================== USERS ===============================
|
||||
|
||||
//POST parameter from API
|
||||
createUser(dni: string, name: string, last_name: string, email: string, phone: number
|
||||
, password: string, user_type: string, status: string, date_entry: Date, community_id: string) {
|
||||
createUser(
|
||||
dni: string,
|
||||
name: string,
|
||||
last_name: string,
|
||||
email: string,
|
||||
phone: number,
|
||||
password: string,
|
||||
user_type: string,
|
||||
status: string,
|
||||
date_entry: Date,
|
||||
community_id: string,
|
||||
) {
|
||||
const pattern = { cmd: 'createUser' };
|
||||
const payload = {
|
||||
dni: dni, name: name, last_name: last_name, email: email, phone: phone,
|
||||
password: password, user_type: user_type, status: status, date_entry: date_entry,
|
||||
community_id: community_id
|
||||
dni: dni,
|
||||
name: name,
|
||||
last_name: last_name,
|
||||
email: email,
|
||||
phone: phone,
|
||||
password: password,
|
||||
user_type: user_type,
|
||||
status: status,
|
||||
date_entry: date_entry,
|
||||
community_id: community_id,
|
||||
};
|
||||
return this.clientUserApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(
|
||||
map((message: string) => ({ message })),
|
||||
);
|
||||
.pipe(map((message: string) => ({ message })));
|
||||
}
|
||||
|
||||
//POST parameter from API
|
||||
createAdminSystem(dni: string, name: string, last_name: string, email: string, phone: number
|
||||
, password: string, user_type: string, status: string, date_entry: Date) {
|
||||
, user_type: string, status: string, date_entry: Date) {
|
||||
const pattern = { cmd: 'createAdminSystem' };
|
||||
const payload = {
|
||||
dni: dni, name: name, last_name: last_name, email: email, phone: phone,
|
||||
password: password, user_type: user_type, status: status, date_entry: date_entry
|
||||
password: this.generatePassword(), user_type: user_type, status: status, date_entry: date_entry
|
||||
};
|
||||
return this.clientUserApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(
|
||||
map((message: string) => ({ message })),
|
||||
);
|
||||
.pipe(map((message: string) => ({ message })));
|
||||
}
|
||||
|
||||
createGuard(dni: string, name: string, last_name: string, email: string, phone: number
|
||||
, password: string, user_type: string, status: string, date_entry: Date, community_id: string) {
|
||||
, user_type: string, status: string, date_entry: Date, community_id: string) {
|
||||
const pattern = { cmd: 'createGuard' };
|
||||
const payload = {
|
||||
dni: dni, name: name, last_name: last_name, email: email, phone: phone,
|
||||
password: password, user_type: user_type, status: status, date_entry: date_entry, community_id
|
||||
password: this.generatePassword(), user_type: user_type, status: status, date_entry: date_entry, community_id
|
||||
|
||||
};
|
||||
return this.clientUserApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(map((message: string) => ({ message })));
|
||||
}
|
||||
|
||||
|
||||
createAdminCommunity(dni: string, name: string, last_name: string, email: string, phone: number
|
||||
, user_type: string, status: string, date_entry: Date, community_id: string) {
|
||||
const pattern = { cmd: 'createAdminCommunity' };
|
||||
const payload = {
|
||||
dni: dni, name: name, last_name: last_name, email: email, phone: phone,
|
||||
password: this.generatePassword(), user_type: user_type, status: status, date_entry: date_entry, community_id
|
||||
|
||||
};
|
||||
return this.clientUserApp
|
||||
|
@ -70,9 +100,7 @@ export class AppService {
|
|||
const payload = {};
|
||||
return this.clientUserApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(
|
||||
map((message: string) => ({ message })),
|
||||
);
|
||||
.pipe(map((message: string) => ({ message })));
|
||||
}
|
||||
|
||||
allUsersAdminSistema() {
|
||||
|
@ -80,9 +108,7 @@ export class AppService {
|
|||
const payload = {};
|
||||
return this.clientUserApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(
|
||||
map((message: string) => ({ message })),
|
||||
);
|
||||
.pipe(map((message: string) => ({ message })));
|
||||
}
|
||||
|
||||
allUsersAdminComunidad() {
|
||||
|
@ -90,9 +116,7 @@ export class AppService {
|
|||
const payload = {};
|
||||
return this.clientUserApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(
|
||||
map((message: string) => ({ message })),
|
||||
);
|
||||
.pipe(map((message: string) => ({ message })));
|
||||
}
|
||||
|
||||
allUsersTenants() {
|
||||
|
@ -112,9 +136,7 @@ export class AppService {
|
|||
const payload = { dni: paramUserDNI };
|
||||
return this.clientUserApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(
|
||||
map((message: string) => ({ message })),
|
||||
);
|
||||
.pipe(map((message: string) => ({ message })));
|
||||
}
|
||||
|
||||
findGuardsCommunity(community_id: string) {
|
||||
|
@ -122,59 +144,55 @@ export class AppService {
|
|||
const payload = { community_id: community_id };
|
||||
return this.clientUserApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(
|
||||
map((message: string) => ({ message })),
|
||||
);
|
||||
.pipe(map((message: string) => ({ message })));
|
||||
}
|
||||
|
||||
|
||||
|
||||
deleteAdminSystem(id: string) {
|
||||
const pattern = { cmd: 'deleteAdminSystem' };
|
||||
const payload = { id: id };
|
||||
return this.clientUserApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(
|
||||
map((message: string) => ({ message })),
|
||||
);
|
||||
.pipe(map((message: string) => ({ message })));
|
||||
}
|
||||
|
||||
inicioSesion(pEmail: string, pPassword: string) {
|
||||
const pattern = { cmd: 'loginUser' };
|
||||
const payload = { email: pEmail, password: pPassword};
|
||||
const payload = { email: pEmail, password: pPassword };
|
||||
return this.clientUserApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(
|
||||
map((message: string) => ({ message })),
|
||||
);
|
||||
.pipe(map((message: string) => ({ message })));
|
||||
}
|
||||
|
||||
|
||||
//GET parameter from API
|
||||
findCommunityAdmin(community_id: string) {
|
||||
const pattern = { cmd: 'findCommunityAdmin' };
|
||||
const payload = { community_id: community_id };
|
||||
return this.clientCommunityApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(
|
||||
map((message: string) => ({ message })),
|
||||
);
|
||||
.pipe(map((message: string) => ({ message })));
|
||||
}
|
||||
|
||||
// ====================== COMMUNITIES ===============================
|
||||
// ====================== COMMUNITIES ===============================
|
||||
|
||||
//POST parameter from API
|
||||
createCommunity(name: string, province: string, canton: string, district: string
|
||||
, num_houses: number, phone: string, status: string, date_entry: Date, houses: []) {
|
||||
, num_houses: number, phone: string, status: string, date_entry: Date, houses: []) {
|
||||
const pattern = { cmd: 'createCommunity' };
|
||||
const payload = {
|
||||
name: name, province: province, canton: canton, district: district, num_houses: num_houses,
|
||||
phone: phone, status: status, date_entry: date_entry, houses: houses
|
||||
name: name,
|
||||
province: province,
|
||||
canton: canton,
|
||||
district: district,
|
||||
num_houses: num_houses,
|
||||
phone: phone,
|
||||
status: status,
|
||||
date_entry: date_entry,
|
||||
houses: houses,
|
||||
};
|
||||
return this.clientCommunityApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(
|
||||
map((message: string) => ({ message })),
|
||||
);
|
||||
.pipe(map((message: string) => ({ message })));
|
||||
}
|
||||
|
||||
allCommunities() {
|
||||
|
@ -182,9 +200,7 @@ export class AppService {
|
|||
const payload = {};
|
||||
return this.clientCommunityApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(
|
||||
map((message: string) => ({ message })),
|
||||
);
|
||||
.pipe(map((message: string) => ({ message })));
|
||||
}
|
||||
|
||||
//GET parameter from API
|
||||
|
@ -193,9 +209,7 @@ export class AppService {
|
|||
const payload = { id: paramCommunityId };
|
||||
return this.clientCommunityApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(
|
||||
map((message: string) => ({ message })),
|
||||
);
|
||||
.pipe(map((message: string) => ({ message })));
|
||||
}
|
||||
|
||||
findCommunityName(paramCommunityId: string) {
|
||||
|
@ -203,27 +217,29 @@ export class AppService {
|
|||
const payload = { id: paramCommunityId };
|
||||
return this.clientCommunityApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(
|
||||
map((message: string) => ({ message })),
|
||||
);
|
||||
.pipe(map((message: string) => ({ message })));
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ====================== COMMON AREAS ===============================
|
||||
// ====================== COMMON AREAS ===============================
|
||||
//POST parameter from API
|
||||
createCommonArea(name: string, hourMin: string, hourMax: string,
|
||||
bookable: number, community_id: string) {
|
||||
createCommonArea(
|
||||
name: string,
|
||||
hourMin: string,
|
||||
hourMax: string,
|
||||
bookable: number,
|
||||
community_id: string,
|
||||
) {
|
||||
const pattern = { cmd: 'createCommonArea' };
|
||||
const payload = {
|
||||
name: name, hourMin: hourMin, hourMax: hourMax, bookable: bookable,
|
||||
community_id: community_id
|
||||
name: name,
|
||||
hourMin: hourMin,
|
||||
hourMax: hourMax,
|
||||
bookable: bookable,
|
||||
community_id: community_id,
|
||||
};
|
||||
return this.clientCommonAreaApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(
|
||||
map((message: string) => ({ message })),
|
||||
);
|
||||
.pipe(map((message: string) => ({ message })));
|
||||
}
|
||||
|
||||
allCommonAreas() {
|
||||
|
@ -231,9 +247,7 @@ export class AppService {
|
|||
const payload = {};
|
||||
return this.clientCommonAreaApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(
|
||||
map((message: string) => ({ message })),
|
||||
);
|
||||
.pipe(map((message: string) => ({ message })));
|
||||
}
|
||||
|
||||
//GET parameter from API
|
||||
|
@ -242,28 +256,29 @@ export class AppService {
|
|||
const payload = { id: paramCommonAreaId };
|
||||
return this.clientCommonAreaApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(
|
||||
map((message: string) => ({ message })),
|
||||
);
|
||||
.pipe(map((message: string) => ({ message })));
|
||||
}
|
||||
|
||||
|
||||
// ====================== GUESTS ===============================
|
||||
|
||||
// ====================== GUESTS ===============================
|
||||
|
||||
//POST parameter from API
|
||||
createGuest(name: string, last_name: string, dni: string, number_plate: string, phone: number
|
||||
, status: string, date_entry: Date) {
|
||||
createGuest(
|
||||
name: string,
|
||||
last_name: string,
|
||||
dni: string,
|
||||
number_plate: string,
|
||||
phone: number,
|
||||
status: string,
|
||||
date_entry: Date,
|
||||
) {
|
||||
const pattern = { cmd: 'createGuest' };
|
||||
const payload = {
|
||||
name: name, last_name: last_name, dni: dni, number_plate: number_plate, phone: phone,
|
||||
name: name, last_name: last_name, dni: dni, number_plate: number_plate, phone: phone,
|
||||
status: status, date_entry: date_entry
|
||||
};
|
||||
return this.clientGuestApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(
|
||||
map((message: string) => ({ message })),
|
||||
);
|
||||
.pipe(map((message: string) => ({ message })));
|
||||
}
|
||||
|
||||
allGuests() {
|
||||
|
@ -271,9 +286,7 @@ export class AppService {
|
|||
const payload = {};
|
||||
return this.clientGuestApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(
|
||||
map((message: string) => ({ message })),
|
||||
);
|
||||
.pipe(map((message: string) => ({ message })));
|
||||
}
|
||||
|
||||
//GET parameter from API
|
||||
|
@ -282,26 +295,29 @@ export class AppService {
|
|||
const payload = { dni: paramGuestDNI };
|
||||
return this.clientGuestApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(
|
||||
map((message: string) => ({ message })),
|
||||
);
|
||||
.pipe(map((message: string) => ({ message })));
|
||||
}
|
||||
|
||||
// ====================== PAYMENTS ===============================
|
||||
// ====================== PAYMENTS ===============================
|
||||
|
||||
//POST parameter from API
|
||||
createPayment(date_payment: Date, mount: number, description: string, period: string
|
||||
, status: string, user_id: string, communty_id: string) {
|
||||
createPayment(
|
||||
date_payment: Date,
|
||||
mount: number,
|
||||
description: string,
|
||||
period: string,
|
||||
status: string,
|
||||
user_id: string,
|
||||
communty_id: string,
|
||||
) {
|
||||
const pattern = { cmd: 'createPayment' };
|
||||
const payload = {
|
||||
date_payment: date_payment, mount: mount, description: description,
|
||||
period: period, status: status, user_id: user_id, communty_id: communty_id
|
||||
date_payment: date_payment, mount: mount, description: description,
|
||||
period: period, status: status, user_id: user_id, communty_id: communty_id
|
||||
};
|
||||
return this.clientPaymentApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(
|
||||
map((message: string) => ({ message })),
|
||||
);
|
||||
.pipe(map((message: string) => ({ message })));
|
||||
}
|
||||
|
||||
allPayments() {
|
||||
|
@ -309,9 +325,7 @@ export class AppService {
|
|||
const payload = {};
|
||||
return this.clientPaymentApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(
|
||||
map((message: string) => ({ message })),
|
||||
);
|
||||
.pipe(map((message: string) => ({ message })));
|
||||
}
|
||||
|
||||
//GET parameter from API
|
||||
|
@ -320,27 +334,22 @@ export class AppService {
|
|||
const payload = { id: paramPaymentId };
|
||||
return this.clientPaymentApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(
|
||||
map((message: string) => ({ message })),
|
||||
);
|
||||
.pipe(map((message: string) => ({ message })));
|
||||
}
|
||||
|
||||
|
||||
// ====================== RESERVATIONS ===============================
|
||||
// ====================== RESERVATIONS ===============================
|
||||
|
||||
//POST parameter from API
|
||||
createReservation(start_time: string, finish_time: string, status: string,
|
||||
createReservation(start_time: string, finish_time: string, status: string,
|
||||
date_entry: Date, user_id: string, common_area_id: string) {
|
||||
const pattern = { cmd: 'createReservation' };
|
||||
const payload = {
|
||||
start_time: start_time, finish_time: finish_time, status: status,
|
||||
date_entry: date_entry, user_id: user_id, common_area_id: common_area_id
|
||||
start_time: start_time, finish_time: finish_time, status: status,
|
||||
date_entry: date_entry, user_id: user_id, common_area_id: common_area_id
|
||||
};
|
||||
return this.clientReservationApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(
|
||||
map((message: string) => ({ message })),
|
||||
);
|
||||
.pipe(map((message: string) => ({ message })));
|
||||
}
|
||||
|
||||
allReservations() {
|
||||
|
@ -348,9 +357,7 @@ export class AppService {
|
|||
const payload = {};
|
||||
return this.clientReservationApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(
|
||||
map((message: string) => ({ message })),
|
||||
);
|
||||
.pipe(map((message: string) => ({ message })));
|
||||
}
|
||||
|
||||
//GET parameter from API
|
||||
|
@ -359,27 +366,22 @@ export class AppService {
|
|||
const payload = { id: paramReservationId };
|
||||
return this.clientReservationApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(
|
||||
map((message: string) => ({ message })),
|
||||
);
|
||||
.pipe(map((message: string) => ({ message })));
|
||||
}
|
||||
|
||||
|
||||
// ====================== POSTS ===============================
|
||||
// ====================== POSTS ===============================
|
||||
|
||||
//POST parameter from API
|
||||
createPost(post: string, date_entry: Date, user_id: string,
|
||||
createPost(post: string, date_entry: Date, user_id: string,
|
||||
community_id: string) {
|
||||
const pattern = { cmd: 'createPost' };
|
||||
const payload = {
|
||||
post: post, date_entry: date_entry, user_id: user_id,
|
||||
post: post, date_entry: date_entry, user_id: user_id,
|
||||
community_id: community_id
|
||||
};
|
||||
return this.clientPostApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(
|
||||
map((message: string) => ({ message })),
|
||||
);
|
||||
.pipe(map((message: string) => ({ message })));
|
||||
}
|
||||
|
||||
allPosts() {
|
||||
|
@ -387,9 +389,7 @@ export class AppService {
|
|||
const payload = {};
|
||||
return this.clientPostApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(
|
||||
map((message: string) => ({ message })),
|
||||
);
|
||||
.pipe(map((message: string) => ({ message })));
|
||||
}
|
||||
|
||||
//GET parameter from API
|
||||
|
@ -398,26 +398,22 @@ export class AppService {
|
|||
const payload = { id: paramPostId };
|
||||
return this.clientPostApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(
|
||||
map((message: string) => ({ message })),
|
||||
);
|
||||
.pipe(map((message: string) => ({ message })));
|
||||
}
|
||||
|
||||
// ====================== COMMNENT POSTS ===============================
|
||||
// ====================== COMMNENT POSTS ===============================
|
||||
|
||||
//Comment parameter from API
|
||||
createComment(comment: string, date_entry: Date, user_id: string,
|
||||
createComment(comment: string, date_entry: Date, user_id: string,
|
||||
post_id: string) {
|
||||
const pattern = { cmd: 'createComment' };
|
||||
const payload = {
|
||||
comment: comment, date_entry: date_entry, user_id: user_id,
|
||||
comment: comment, date_entry: date_entry, user_id: user_id,
|
||||
post_id: post_id
|
||||
};
|
||||
return this.clientPostApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(
|
||||
map((message: string) => ({ message })),
|
||||
);
|
||||
.pipe(map((message: string) => ({ message })));
|
||||
}
|
||||
|
||||
allComments() {
|
||||
|
@ -425,9 +421,7 @@ export class AppService {
|
|||
const payload = {};
|
||||
return this.clientPostApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(
|
||||
map((message: string) => ({ message })),
|
||||
);
|
||||
.pipe(map((message: string) => ({ message })));
|
||||
}
|
||||
|
||||
//GET parameter from API
|
||||
|
@ -436,26 +430,22 @@ export class AppService {
|
|||
const payload = { id: paramCommentId };
|
||||
return this.clientPostApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(
|
||||
map((message: string) => ({ message })),
|
||||
);
|
||||
.pipe(map((message: string) => ({ message })));
|
||||
}
|
||||
|
||||
// ====================== REPORTS ===============================
|
||||
// ====================== REPORTS ===============================
|
||||
|
||||
//Report parameter from API
|
||||
createReport(action: string, description: string, date_entry: Date,
|
||||
createReport(action: string, description: string, date_entry: Date,
|
||||
user_id: string) {
|
||||
const pattern = { cmd: 'createReport' };
|
||||
const payload = {
|
||||
action: action, description: description, date_entry: date_entry,
|
||||
action: action, description: description, date_entry: date_entry,
|
||||
user_id: user_id
|
||||
};
|
||||
return this.clientReportApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(
|
||||
map((message: string) => ({ message })),
|
||||
);
|
||||
.pipe(map((message: string) => ({ message })));
|
||||
}
|
||||
|
||||
allReports() {
|
||||
|
@ -463,9 +453,7 @@ export class AppService {
|
|||
const payload = {};
|
||||
return this.clientReportApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(
|
||||
map((message: string) => ({ message })),
|
||||
);
|
||||
.pipe(map((message: string) => ({ message })));
|
||||
}
|
||||
|
||||
//GET parameter from API
|
||||
|
@ -474,29 +462,40 @@ export class AppService {
|
|||
const payload = { id: paramReportId };
|
||||
return this.clientReportApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(
|
||||
map((message: string) => ({ message })),
|
||||
);
|
||||
.pipe(map((message: string) => ({ message })));
|
||||
}
|
||||
|
||||
|
||||
sendMail(email: string) {
|
||||
const pattern = { cmd: 'sendMail' };
|
||||
const payload = { email: email};
|
||||
const payload = { email: email };
|
||||
return this.clientNotificationtApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(
|
||||
map((message: string) => ({ message })),
|
||||
);
|
||||
.pipe(map((message: string) => ({ message })));
|
||||
}
|
||||
|
||||
html(email: string, name: string) {
|
||||
const pattern = { cmd: 'html' };
|
||||
const payload = { email: email, name: name};
|
||||
const payload = { email: email, name: name };
|
||||
return this.clientNotificationtApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(
|
||||
map((message: string) => ({ message })),
|
||||
);
|
||||
.pipe(map((message: string) => ({ message })));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Function to generate combination of password */
|
||||
generatePassword() {
|
||||
var pass = '';
|
||||
var str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' +
|
||||
'abcdefghijklmnopqrstuvwxyz0123456789@#$';
|
||||
|
||||
for (let i = 1; i <= 8; i++) {
|
||||
var char = Math.floor(Math.random()
|
||||
* str.length + 1);
|
||||
|
||||
pass += str.charAt(char)
|
||||
}
|
||||
|
||||
return pass;
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"devDependencies": {
|
||||
"husky": "^8.0.1",
|
||||
"js-beautify": "^1.14.4",
|
||||
"lint-staged": "^13.0.3",
|
||||
"prettier": "^2.7.1"
|
||||
},
|
||||
"scripts": {
|
||||
"format": "npm run format:prettier && npm run format:html",
|
||||
"format:prettier": "prettier --config .prettierrc \"**/src/**/*.{ts,css,less,scss,js}\" --write",
|
||||
"format:html": "js-beautify --config .jsbeautifyrc --type 'html' --file '**/src/**/*.html' --replace"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "lint-staged"
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{ts,css,less,scss,js}": [
|
||||
"prettier --config .prettierrc --write",
|
||||
"git add"
|
||||
],
|
||||
"*.html": [
|
||||
"js-beautify --config .jsbeautifyrc --type 'html' --replace",
|
||||
"git add"
|
||||
]
|
||||
}
|
||||
}
|
|
@ -5,9 +5,11 @@ import { MongooseModule } from '@nestjs/mongoose';
|
|||
import { BooksModule } from './books/books.module';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
MongooseModule.forRoot(`mongodb+srv://proyecto_4:proyecto_4@proyecto4.yv4fb.mongodb.net/servicio_books?retryWrites=true&w=majority`),
|
||||
BooksModule,
|
||||
imports: [
|
||||
MongooseModule.forRoot(
|
||||
`mongodb+srv://proyecto_4:proyecto_4@proyecto4.yv4fb.mongodb.net/servicio_books?retryWrites=true&w=majority`,
|
||||
),
|
||||
BooksModule,
|
||||
],
|
||||
controllers: [AppController],
|
||||
providers: [AppService],
|
||||
|
|
|
@ -9,7 +9,7 @@ import {
|
|||
Delete,
|
||||
} from '@nestjs/common';
|
||||
import { ApiTags } from '@nestjs/swagger';
|
||||
import { Request } from 'express';
|
||||
import { Request } from 'express';
|
||||
import { BooksService } from './books.service';
|
||||
import { CreateBookDto } from './dto/create-book.dto';
|
||||
import { UpdateBookDto } from './dto/update-book.dto';
|
||||
|
@ -26,8 +26,8 @@ export class BooksController {
|
|||
}
|
||||
|
||||
@Get()
|
||||
findAll(@Req() request: Request) {
|
||||
return this.booksService.findAll(request);
|
||||
findAll(@Req() request: Request) {
|
||||
return this.booksService.findAll(request);
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
|
@ -44,4 +44,4 @@ export class BooksController {
|
|||
remove(@Param('id') id: string) {
|
||||
return this.booksService.remove(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,9 +6,9 @@ import { Book, BookSchema } from './schemas/book.schema';
|
|||
|
||||
@Module({
|
||||
imports: [
|
||||
MongooseModule.forFeature([{ name: Book.name, schema: BookSchema }]),
|
||||
MongooseModule.forFeature([{ name: Book.name, schema: BookSchema }]),
|
||||
],
|
||||
controllers: [BooksController],
|
||||
providers: [BooksService]
|
||||
providers: [BooksService],
|
||||
})
|
||||
export class BooksModule {}
|
||||
|
|
|
@ -4,7 +4,7 @@ import { UpdateBookDto } from './dto/update-book.dto';
|
|||
import { InjectModel } from '@nestjs/mongoose';
|
||||
import { Book, BookDocument } from './schemas/book.schema';
|
||||
import { Model } from 'mongoose';
|
||||
import { Request } from 'express';
|
||||
import { Request } from 'express';
|
||||
|
||||
@Injectable()
|
||||
export class BooksService {
|
||||
|
@ -16,10 +16,10 @@ export class BooksService {
|
|||
return this.bookModel.create(book);
|
||||
}
|
||||
|
||||
async findAll(request: Request): Promise<Book[]> {
|
||||
async findAll(request: Request): Promise<Book[]> {
|
||||
return this.bookModel
|
||||
.find(request.query)
|
||||
.setOptions({ sanitizeFilter: true })
|
||||
.find(request.query)
|
||||
.setOptions({ sanitizeFilter: true })
|
||||
.exec();
|
||||
}
|
||||
|
||||
|
@ -36,4 +36,4 @@ export class BooksService {
|
|||
async remove(id: string) {
|
||||
return this.bookModel.findByIdAndRemove({ _id: id }).exec();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
import { ApiProperty } from '@nestjs/swagger';
|
||||
|
||||
|
||||
|
||||
export class CreateBookDto {
|
||||
@ApiProperty({
|
||||
@ApiProperty({
|
||||
example: 'Nest.js: A Progressive Node.js Framework (English Edition)',
|
||||
})
|
||||
readonly title: string;
|
||||
readonly title: string;
|
||||
|
||||
@ApiProperty({ example: 'Web Development' })
|
||||
readonly genre: string;
|
||||
|
@ -28,6 +26,6 @@ export class CreateBookDto {
|
|||
})
|
||||
readonly image_url: string;
|
||||
|
||||
@ApiProperty({ example: ['NestJS', 'REST API'] })
|
||||
@ApiProperty({ example: ['NestJS', 'REST API'] })
|
||||
readonly keywords: string[];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import { Schema, Prop, SchemaFactory } from '@nestjs/mongoose';
|
||||
import { Document } from 'mongoose';
|
||||
import { Document } from 'mongoose';
|
||||
|
||||
export type BookDocument = Book & Document;
|
||||
export type BookDocument = Book & Document;
|
||||
|
||||
@Schema()
|
||||
@Schema()
|
||||
export class Book {
|
||||
@Prop()
|
||||
@Prop()
|
||||
genre: string;
|
||||
|
||||
@Prop()
|
||||
|
@ -20,8 +20,8 @@ export class Book {
|
|||
@Prop()
|
||||
image_url: string;
|
||||
|
||||
@Prop([String])
|
||||
@Prop([String])
|
||||
keywords: string[];
|
||||
}
|
||||
|
||||
export const BookSchema = SchemaFactory.createForClass(Book);
|
||||
export const BookSchema = SchemaFactory.createForClass(Book);
|
||||
|
|
|
@ -6,16 +6,16 @@ async function bootstrap() {
|
|||
const app = await NestFactory.create(AppModule);
|
||||
|
||||
// Configurar títulos de documentación
|
||||
const options = new DocumentBuilder()
|
||||
const options = new DocumentBuilder()
|
||||
.setTitle('MongoDB Book REST API')
|
||||
.setDescription('API REST para libros con MongoDB')
|
||||
.setVersion('1.0')
|
||||
.build();
|
||||
const document = SwaggerModule.createDocument(app, options);
|
||||
const document = SwaggerModule.createDocument(app, options);
|
||||
|
||||
// La ruta en que se sirve la documentación
|
||||
SwaggerModule.setup('docs', app, document);
|
||||
SwaggerModule.setup('docs', app, document);
|
||||
|
||||
await app.listen(3000);
|
||||
}
|
||||
bootstrap();
|
||||
bootstrap();
|
||||
|
|
|
@ -1,23 +1,25 @@
|
|||
import { Module } from '@nestjs/common';
|
||||
import { CommonAreasModule } from './common_areas/common_areas.module';
|
||||
import { MongooseModule } from '@nestjs/mongoose';
|
||||
import { ClientsModule, Transport } from "@nestjs/microservices";
|
||||
|
||||
import { ClientsModule, Transport } from '@nestjs/microservices';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
ClientsModule.register([
|
||||
{
|
||||
name: "SERVICIO_AREAS_COMUNES",
|
||||
name: 'SERVICIO_AREAS_COMUNES',
|
||||
transport: Transport.TCP,
|
||||
options: {
|
||||
host: "127.0.0.1",
|
||||
port: 3003
|
||||
}
|
||||
}
|
||||
host: '127.0.0.1',
|
||||
port: 3003,
|
||||
},
|
||||
},
|
||||
]),
|
||||
MongooseModule.forRoot(`mongodb+srv://proyecto_4:proyecto_4@proyecto4.yv4fb.mongodb.net/servicio_areas_comunes?retryWrites=true&w=majority`),
|
||||
CommonAreasModule],
|
||||
MongooseModule.forRoot(
|
||||
`mongodb+srv://proyecto_4:proyecto_4@proyecto4.yv4fb.mongodb.net/servicio_areas_comunes?retryWrites=true&w=majority`,
|
||||
),
|
||||
CommonAreasModule,
|
||||
],
|
||||
controllers: [],
|
||||
providers: [],
|
||||
})
|
||||
|
|
|
@ -7,28 +7,28 @@ import { CommonAreasService } from './common_areas.service';
|
|||
export class CommonAreasController {
|
||||
constructor(private readonly commonAreasService: CommonAreasService) {}
|
||||
|
||||
@MessagePattern({cmd: 'createCommonArea'})
|
||||
@MessagePattern({ cmd: 'createCommonArea' })
|
||||
create(@Payload() commonArea: CommonAreaDocument) {
|
||||
return this.commonAreasService.create(commonArea);
|
||||
}
|
||||
|
||||
@MessagePattern({cmd: 'findAllCommonAreas'})
|
||||
@MessagePattern({ cmd: 'findAllCommonAreas' })
|
||||
findAll() {
|
||||
return this.commonAreasService.findAll();
|
||||
}
|
||||
|
||||
@MessagePattern({cmd: 'findOneCommonArea'})
|
||||
@MessagePattern({ cmd: 'findOneCommonArea' })
|
||||
findOne(@Payload() id: string) {
|
||||
let _id = id['_id'];
|
||||
return this.commonAreasService.findOne(_id);
|
||||
}
|
||||
|
||||
@MessagePattern({cmd: 'updateCommonArea'})
|
||||
@MessagePattern({ cmd: 'updateCommonArea' })
|
||||
update(@Payload() commonArea: CommonAreaDocument) {
|
||||
return this.commonAreasService.update(commonArea.id, commonArea);
|
||||
}
|
||||
|
||||
@MessagePattern({cmd: 'removeCommonArea'})
|
||||
@MessagePattern({ cmd: 'removeCommonArea' })
|
||||
remove(@Payload() id: string) {
|
||||
let _id = id['_id'];
|
||||
return this.commonAreasService.remove(_id);
|
||||
|
|
|
@ -6,9 +6,11 @@ import { MongooseModule } from '@nestjs/mongoose';
|
|||
import { CommonArea, CommonAreaSchema } from '../schemas/common_area.schema';
|
||||
@Module({
|
||||
imports: [
|
||||
MongooseModule.forFeature([{ name: CommonArea.name, schema: CommonAreaSchema }]),
|
||||
MongooseModule.forFeature([
|
||||
{ name: CommonArea.name, schema: CommonAreaSchema },
|
||||
]),
|
||||
],
|
||||
controllers: [CommonAreasController],
|
||||
providers: [CommonAreasService]
|
||||
providers: [CommonAreasService],
|
||||
})
|
||||
export class CommonAreasModule {}
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
import { Injectable } from '@nestjs/common';
|
||||
import { CommonArea, CommonAreaDocument } from 'src/schemas/common_area.schema';
|
||||
import { CommonArea, CommonAreaDocument } from 'src/schemas/common_area.schema';
|
||||
import { InjectModel } from '@nestjs/mongoose';
|
||||
import { Model } from 'mongoose';
|
||||
|
||||
@Injectable()
|
||||
export class CommonAreasService {
|
||||
|
||||
constructor(
|
||||
@InjectModel(CommonArea.name) private readonly commonAreaModel: Model<CommonAreaDocument>,
|
||||
@InjectModel(CommonArea.name)
|
||||
private readonly commonAreaModel: Model<CommonAreaDocument>,
|
||||
) {}
|
||||
|
||||
async create(commonArea: CommonAreaDocument): Promise<CommonArea> {
|
||||
return this.commonAreaModel.create(commonArea);
|
||||
}
|
||||
|
||||
async findAll(): Promise<CommonArea[]> {
|
||||
async findAll(): Promise<CommonArea[]> {
|
||||
return this.commonAreaModel
|
||||
.find()
|
||||
.setOptions({ sanitizeFilter: true })
|
||||
.find()
|
||||
.setOptions({ sanitizeFilter: true })
|
||||
.exec();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { NestFactory } from "@nestjs/core";
|
||||
import { Transport } from "@nestjs/microservices";
|
||||
import { AppModule } from "./app.module";
|
||||
import { Logger } from "@nestjs/common";
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { Transport } from '@nestjs/microservices';
|
||||
import { AppModule } from './app.module';
|
||||
import { Logger } from '@nestjs/common';
|
||||
|
||||
const logger = new Logger();
|
||||
|
||||
|
@ -9,10 +9,12 @@ async function bootstrap() {
|
|||
const app = await NestFactory.createMicroservice(AppModule, {
|
||||
transport: Transport.TCP,
|
||||
options: {
|
||||
host: "127.0.0.1",
|
||||
port: 3003
|
||||
}
|
||||
host: '127.0.0.1',
|
||||
port: 3003,
|
||||
},
|
||||
});
|
||||
app.listen().then(() => logger.log("Microservice Áreas Comunes is listening" ));
|
||||
app
|
||||
.listen()
|
||||
.then(() => logger.log('Microservice Áreas Comunes is listening'));
|
||||
}
|
||||
bootstrap();
|
||||
bootstrap();
|
||||
|
|
|
@ -1,29 +1,26 @@
|
|||
|
||||
import { Schema, Prop, SchemaFactory } from '@nestjs/mongoose';
|
||||
import { Document } from 'mongoose';
|
||||
import { Timestamp } from 'rxjs';
|
||||
import { TimerOptions } from 'timers';
|
||||
|
||||
|
||||
export type CommonAreaDocument = CommonArea & Document;
|
||||
|
||||
@Schema({ collection: 'common_areas' })
|
||||
export class CommonArea {
|
||||
@Prop()
|
||||
name: string;
|
||||
|
||||
@Prop()
|
||||
name: string;
|
||||
@Prop()
|
||||
hourMin: string; //hora militar, separado por dos puntos
|
||||
|
||||
@Prop()
|
||||
hourMin: string; //hora militar, separado por dos puntos
|
||||
@Prop()
|
||||
hourMax: string; //hora militar, separado por dos puntos
|
||||
|
||||
@Prop()
|
||||
hourMax: string; //hora militar, separado por dos puntos
|
||||
@Prop()
|
||||
bookable: number; //saber si es necesario reservarlo o no
|
||||
|
||||
@Prop()
|
||||
bookable: number; //saber si es necesario reservarlo o no
|
||||
|
||||
@Prop()
|
||||
community_id: string;
|
||||
@Prop()
|
||||
community_id: string;
|
||||
}
|
||||
|
||||
export const CommonAreaSchema = SchemaFactory.createForClass(CommonArea);
|
||||
export const CommonAreaSchema = SchemaFactory.createForClass(CommonArea);
|
||||
|
|
|
@ -1,24 +1,26 @@
|
|||
import { Module } from '@nestjs/common';
|
||||
import { CommunitiesModule } from './communities/communities.module';
|
||||
import { MongooseModule } from '@nestjs/mongoose';
|
||||
import { ClientsModule, Transport } from "@nestjs/microservices";
|
||||
|
||||
import { ClientsModule, Transport } from '@nestjs/microservices';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
ClientsModule.register([
|
||||
{
|
||||
name: "SERVICIO_COMUNIDADES",
|
||||
name: 'SERVICIO_COMUNIDADES',
|
||||
transport: Transport.TCP,
|
||||
options: {
|
||||
host: "127.0.0.1",
|
||||
port: 3002
|
||||
}
|
||||
}
|
||||
host: '127.0.0.1',
|
||||
port: 3002,
|
||||
},
|
||||
},
|
||||
]),
|
||||
MongooseModule.forRoot(`mongodb+srv://proyecto_4:proyecto_4@proyecto4.yv4fb.mongodb.net/servicio_comunidades?retryWrites=true&w=majority`),
|
||||
CommunitiesModule],
|
||||
MongooseModule.forRoot(
|
||||
`mongodb+srv://proyecto_4:proyecto_4@proyecto4.yv4fb.mongodb.net/servicio_comunidades?retryWrites=true&w=majority`,
|
||||
),
|
||||
CommunitiesModule,
|
||||
],
|
||||
controllers: [],
|
||||
providers: [],
|
||||
})
|
||||
export class AppModule { }
|
||||
export class AppModule {}
|
||||
|
|
|
@ -12,35 +12,35 @@ export class CommunitiesController {
|
|||
return this.communitiesService.create(community);
|
||||
}
|
||||
|
||||
@MessagePattern({cmd: 'findAllCommunities'})
|
||||
@MessagePattern({ cmd: 'findAllCommunities' })
|
||||
findAll() {
|
||||
return this.communitiesService.findAll();
|
||||
}
|
||||
|
||||
@MessagePattern({cmd: 'findOneCommunity'})
|
||||
@MessagePattern({ cmd: 'findOneCommunity' })
|
||||
findOne(@Payload() id: string) {
|
||||
let _id = id['_id'];
|
||||
return this.communitiesService.findOne(_id);
|
||||
}
|
||||
|
||||
@MessagePattern({cmd: 'findCommunityName'})
|
||||
@MessagePattern({ cmd: 'findCommunityName' })
|
||||
findOneName(@Payload() id: string) {
|
||||
let _id = id['id'];
|
||||
return this.communitiesService.findOneName(_id);
|
||||
}
|
||||
|
||||
/* @MessagePattern({cmd: 'findCommunityAdmin'})
|
||||
/* @MessagePattern({cmd: 'findCommunityAdmin'})
|
||||
findCommunityAdmin(@Payload() community: any) {
|
||||
let _community = community['community_id'];
|
||||
return this.communitiesService.findCommunityAdmin(_community, "2");
|
||||
}*/
|
||||
|
||||
@MessagePattern({cmd: 'updateCommunity'})
|
||||
@MessagePattern({ cmd: 'updateCommunity' })
|
||||
update(@Payload() community: CommunityDocument) {
|
||||
return this.communitiesService.update(community.id, community);
|
||||
}
|
||||
|
||||
@MessagePattern({cmd: 'removeCommunity'})
|
||||
@MessagePattern({ cmd: 'removeCommunity' })
|
||||
remove(@Payload() id: string) {
|
||||
let _id = id['_id'];
|
||||
return this.communitiesService.remove(_id);
|
||||
|
|
|
@ -2,26 +2,27 @@ import { Module } from '@nestjs/common';
|
|||
import { CommunitiesService } from './communities.service';
|
||||
import { CommunitiesController } from './communities.controller';
|
||||
import { MongooseModule } from '@nestjs/mongoose';
|
||||
import { ClientsModule, Transport } from "@nestjs/microservices";
|
||||
import { ClientsModule, Transport } from '@nestjs/microservices';
|
||||
|
||||
import { Community, CommunitySchema } from '../schemas/community.schema';
|
||||
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
ClientsModule.register([
|
||||
{
|
||||
name: "SERVICIO_USUARIOS",
|
||||
name: 'SERVICIO_USUARIOS',
|
||||
transport: Transport.TCP,
|
||||
options: {
|
||||
host: "127.0.0.1",
|
||||
port: 3001
|
||||
}
|
||||
}
|
||||
host: '127.0.0.1',
|
||||
port: 3001,
|
||||
},
|
||||
},
|
||||
]),
|
||||
MongooseModule.forFeature([
|
||||
{ name: Community.name, schema: CommunitySchema },
|
||||
]),
|
||||
MongooseModule.forFeature([{ name: Community.name, schema: CommunitySchema }]),
|
||||
],
|
||||
controllers: [CommunitiesController],
|
||||
providers: [CommunitiesService]
|
||||
providers: [CommunitiesService],
|
||||
})
|
||||
export class CommunitiesModule {}
|
||||
|
|
|
@ -7,40 +7,39 @@ import { from, lastValueFrom, map, scan, mergeMap } from 'rxjs';
|
|||
import { Admin } from 'src/schemas/admin.entity';
|
||||
import { appendFileSync } from 'fs';
|
||||
|
||||
|
||||
@Injectable()
|
||||
export class CommunitiesService {
|
||||
|
||||
constructor(
|
||||
@InjectModel(Community.name) private readonly communityModel: Model<CommunityDocument>,
|
||||
@InjectModel(Community.name)
|
||||
private readonly communityModel: Model<CommunityDocument>,
|
||||
@Inject('SERVICIO_USUARIOS') private readonly clientUserApp: ClientProxy,
|
||||
|
||||
) { }
|
||||
) {}
|
||||
|
||||
async create(community: CommunityDocument): Promise<Community> {
|
||||
return this.communityModel.create(community);
|
||||
}
|
||||
|
||||
async findAll(): Promise<Community[]> {
|
||||
|
||||
return await this.communityModel
|
||||
.find()
|
||||
.setOptions({ sanitizeFilter: true })
|
||||
.exec()
|
||||
.then(async community => {
|
||||
.then(async (community) => {
|
||||
if (community) {
|
||||
await Promise.all(community.map(async c => {
|
||||
//buscar al usuario con el id de la comunidad anexado
|
||||
let admin = await this.findCommunityAdmin(c["_id"], "2")
|
||||
if (admin) {
|
||||
c["id_admin"] = admin["_id"]
|
||||
c["name_admin"] = admin["name"]
|
||||
}
|
||||
return c
|
||||
}))
|
||||
await Promise.all(
|
||||
community.map(async (c) => {
|
||||
//buscar al usuario con el id de la comunidad anexado
|
||||
let admin = await this.findCommunityAdmin(c['_id'], '2');
|
||||
if (admin) {
|
||||
c['id_admin'] = admin['_id'];
|
||||
c['name_admin'] = admin['name'];
|
||||
}
|
||||
return c;
|
||||
}),
|
||||
);
|
||||
}
|
||||
return community;
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
findOne(id: string): Promise<Community> {
|
||||
|
@ -61,17 +60,14 @@ export class CommunitiesService {
|
|||
}
|
||||
|
||||
async findCommunityAdmin(community: string, user_type: string) {
|
||||
const pattern = { cmd: 'findOneCommunityUser' }
|
||||
const payload = { community_id: community, user_type: user_type }
|
||||
const pattern = { cmd: 'findOneCommunityUser' };
|
||||
const payload = { community_id: community, user_type: user_type };
|
||||
|
||||
let callback = await this.clientUserApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(
|
||||
map((response: string) => ({ response }))
|
||||
)
|
||||
.pipe(map((response: string) => ({ response })));
|
||||
|
||||
const finalValue = await lastValueFrom(callback);
|
||||
return finalValue['response'];
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { NestFactory } from "@nestjs/core";
|
||||
import { Transport } from "@nestjs/microservices";
|
||||
import { AppModule } from "./app.module";
|
||||
import { Logger } from "@nestjs/common";
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { Transport } from '@nestjs/microservices';
|
||||
import { AppModule } from './app.module';
|
||||
import { Logger } from '@nestjs/common';
|
||||
|
||||
const logger = new Logger();
|
||||
|
||||
|
@ -9,10 +9,14 @@ async function bootstrap() {
|
|||
const app = await NestFactory.createMicroservice(AppModule, {
|
||||
transport: Transport.TCP,
|
||||
options: {
|
||||
host: "127.0.0.1",
|
||||
port: 3002
|
||||
}
|
||||
host: '127.0.0.1',
|
||||
port: 3002,
|
||||
},
|
||||
});
|
||||
app.listen().then(() => logger.log("Microservice Comunidades de vivienda is listening" ));
|
||||
app
|
||||
.listen()
|
||||
.then(() =>
|
||||
logger.log('Microservice Comunidades de vivienda is listening'),
|
||||
);
|
||||
}
|
||||
bootstrap();
|
||||
bootstrap();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export interface Admin {
|
||||
id_community: string;
|
||||
user_type: string;
|
||||
}
|
||||
id_community: string;
|
||||
user_type: string;
|
||||
}
|
||||
|
|
|
@ -2,45 +2,42 @@ import { Schema, Prop, SchemaFactory } from '@nestjs/mongoose';
|
|||
import { Document } from 'mongoose';
|
||||
import { House, HouseSchema } from './house.schema';
|
||||
|
||||
|
||||
export type CommunityDocument = Community & Document;
|
||||
|
||||
@Schema({ collection: 'communities' })
|
||||
export class Community {
|
||||
@Prop()
|
||||
id_admin: string;
|
||||
@Prop()
|
||||
id_admin: string;
|
||||
|
||||
@Prop()
|
||||
name_admin: string ;
|
||||
@Prop()
|
||||
name_admin: string;
|
||||
|
||||
@Prop()
|
||||
name: string;
|
||||
@Prop()
|
||||
name: string;
|
||||
|
||||
@Prop()
|
||||
province: string;
|
||||
@Prop()
|
||||
province: string;
|
||||
|
||||
@Prop()
|
||||
canton: string;
|
||||
@Prop()
|
||||
canton: string;
|
||||
|
||||
@Prop()
|
||||
district: string;
|
||||
@Prop()
|
||||
district: string;
|
||||
|
||||
@Prop()
|
||||
num_houses: number;
|
||||
@Prop()
|
||||
num_houses: number;
|
||||
|
||||
@Prop()
|
||||
phone: string;
|
||||
@Prop()
|
||||
phone: string;
|
||||
|
||||
@Prop()
|
||||
status: string;
|
||||
@Prop()
|
||||
status: string;
|
||||
|
||||
@Prop()
|
||||
date_entry: Date;
|
||||
|
||||
@Prop({ type: [HouseSchema] })
|
||||
houses: Array<House>;
|
||||
@Prop()
|
||||
date_entry: Date;
|
||||
|
||||
@Prop({ type: [HouseSchema] })
|
||||
houses: Array<House>;
|
||||
}
|
||||
|
||||
|
||||
export const CommunitySchema = SchemaFactory.createForClass(Community);
|
||||
export const CommunitySchema = SchemaFactory.createForClass(Community);
|
||||
|
|
|
@ -4,17 +4,15 @@ import { Document } from 'mongoose';
|
|||
import { empty } from 'rxjs';
|
||||
import { Tenant, TenantSchema } from './tenant.schema';
|
||||
|
||||
|
||||
|
||||
@Schema()
|
||||
export class House extends Document {
|
||||
@Prop({ default: " " })
|
||||
number_house: string;
|
||||
export class House extends Document {
|
||||
@Prop({ default: ' ' })
|
||||
number_house: string;
|
||||
|
||||
@Prop({ default: "desocupada" })
|
||||
state: string;
|
||||
@Prop({ default: 'desocupada' })
|
||||
state: string;
|
||||
|
||||
@Prop({ type: TenantSchema })
|
||||
tenants: Tenant;
|
||||
@Prop({ type: TenantSchema })
|
||||
tenants: Tenant;
|
||||
}
|
||||
export const HouseSchema = SchemaFactory.createForClass(House);
|
||||
export const HouseSchema = SchemaFactory.createForClass(House);
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
import { Schema, Prop, SchemaFactory } from '@nestjs/mongoose';
|
||||
|
||||
|
||||
|
||||
@Schema()
|
||||
export class Tenant {
|
||||
@Prop( {default: ''})
|
||||
tenant_id: string;
|
||||
@Prop({ default: '' })
|
||||
tenant_id: string;
|
||||
}
|
||||
|
||||
export const TenantSchema = SchemaFactory.createForClass(Tenant);
|
||||
export const TenantSchema = SchemaFactory.createForClass(Tenant);
|
||||
|
|
|
@ -1,23 +1,27 @@
|
|||
import { Module } from '@nestjs/common';
|
||||
import { MongooseModule } from '@nestjs/mongoose';
|
||||
import { ClientsModule, Transport } from "@nestjs/microservices";
|
||||
import { ClientsModule, Transport } from '@nestjs/microservices';
|
||||
import { PostsModule } from './posts/posts.module';
|
||||
import { PostCommentsModule } from './post-comments/post-comments.module';
|
||||
|
||||
@Module({
|
||||
imports: [ ClientsModule.register([
|
||||
{
|
||||
name: "SERVICIO_POSTS",
|
||||
transport: Transport.TCP,
|
||||
options: {
|
||||
host: "127.0.0.1",
|
||||
port: 3007
|
||||
}
|
||||
}
|
||||
]),
|
||||
MongooseModule.forRoot(`mongodb+srv://proyecto_4:proyecto_4@proyecto4.yv4fb.mongodb.net/servicio_posts?retryWrites=true&w=majority`),
|
||||
PostsModule,
|
||||
PostCommentsModule],
|
||||
imports: [
|
||||
ClientsModule.register([
|
||||
{
|
||||
name: 'SERVICIO_POSTS',
|
||||
transport: Transport.TCP,
|
||||
options: {
|
||||
host: '127.0.0.1',
|
||||
port: 3007,
|
||||
},
|
||||
},
|
||||
]),
|
||||
MongooseModule.forRoot(
|
||||
`mongodb+srv://proyecto_4:proyecto_4@proyecto4.yv4fb.mongodb.net/servicio_posts?retryWrites=true&w=majority`,
|
||||
),
|
||||
PostsModule,
|
||||
PostCommentsModule,
|
||||
],
|
||||
controllers: [],
|
||||
providers: [],
|
||||
})
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { NestFactory } from "@nestjs/core";
|
||||
import { Transport } from "@nestjs/microservices";
|
||||
import { AppModule } from "./app.module";
|
||||
import { Logger } from "@nestjs/common";
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { Transport } from '@nestjs/microservices';
|
||||
import { AppModule } from './app.module';
|
||||
import { Logger } from '@nestjs/common';
|
||||
|
||||
const logger = new Logger();
|
||||
|
||||
|
@ -9,10 +9,10 @@ async function bootstrap() {
|
|||
const app = await NestFactory.createMicroservice(AppModule, {
|
||||
transport: Transport.TCP,
|
||||
options: {
|
||||
host: "127.0.0.1",
|
||||
port: 3007
|
||||
}
|
||||
host: '127.0.0.1',
|
||||
port: 3007,
|
||||
},
|
||||
});
|
||||
app.listen().then(() => logger.log("Microservice Comunicados is listening" ));
|
||||
app.listen().then(() => logger.log('Microservice Comunicados is listening'));
|
||||
}
|
||||
bootstrap();
|
||||
bootstrap();
|
||||
|
|
|
@ -3,7 +3,6 @@ import { MessagePattern, Payload } from '@nestjs/microservices';
|
|||
import { PostCommentsService } from './post-comments.service';
|
||||
import { Comment, CommentDocument } from '../schemas/post-comment.schema';
|
||||
|
||||
|
||||
@Controller()
|
||||
export class PostCommentsController {
|
||||
constructor(private readonly postCommentsService: PostCommentsService) {}
|
||||
|
@ -18,7 +17,7 @@ export class PostCommentsController {
|
|||
return this.postCommentsService.findAll();
|
||||
}
|
||||
|
||||
@MessagePattern({cmd: 'findOneComment'})
|
||||
@MessagePattern({ cmd: 'findOneComment' })
|
||||
findOne(@Payload() id: string) {
|
||||
let _id = id['id'];
|
||||
return this.postCommentsService.findOne(_id);
|
||||
|
|
|
@ -6,9 +6,9 @@ import { Comment, CommentSchema } from '../schemas/post-comment.schema';
|
|||
|
||||
@Module({
|
||||
imports: [
|
||||
MongooseModule.forFeature([{ name: Comment.name, schema: CommentSchema }]),
|
||||
MongooseModule.forFeature([{ name: Comment.name, schema: CommentSchema }]),
|
||||
],
|
||||
controllers: [PostCommentsController],
|
||||
providers: [PostCommentsService]
|
||||
providers: [PostCommentsService],
|
||||
})
|
||||
export class PostCommentsModule {}
|
||||
|
|
|
@ -3,24 +3,21 @@ import { Comment, CommentDocument } from '../schemas/post-comment.schema';
|
|||
import { Model } from 'mongoose';
|
||||
import { InjectModel } from '@nestjs/mongoose';
|
||||
|
||||
|
||||
@Injectable()
|
||||
export class PostCommentsService {
|
||||
constructor(
|
||||
@InjectModel(Comment.name) private readonly commentModel: Model<CommentDocument>,
|
||||
@InjectModel(Comment.name)
|
||||
private readonly commentModel: Model<CommentDocument>,
|
||||
) {}
|
||||
|
||||
async create(comment: CommentDocument): Promise<Comment> {
|
||||
return this.commentModel.create(comment);
|
||||
}
|
||||
|
||||
async findAll(): Promise<Comment[]> {
|
||||
return this.commentModel
|
||||
.find()
|
||||
.setOptions({ sanitizeFilter: true })
|
||||
.exec();
|
||||
async findAll(): Promise<Comment[]> {
|
||||
return this.commentModel.find().setOptions({ sanitizeFilter: true }).exec();
|
||||
}
|
||||
|
||||
|
||||
async findOne(id: string): Promise<Comment> {
|
||||
return this.commentModel.findOne({ _id: id }).exec();
|
||||
}
|
||||
|
|
|
@ -3,10 +3,9 @@ import { MessagePattern, Payload } from '@nestjs/microservices';
|
|||
import { PostsService } from './posts.service';
|
||||
import { Post, PostDocument } from '../schemas/post.schema';
|
||||
|
||||
|
||||
@Controller()
|
||||
export class PostsController {
|
||||
constructor(private readonly postsService: PostsService) { }
|
||||
constructor(private readonly postsService: PostsService) {}
|
||||
|
||||
@MessagePattern({ cmd: 'createPost' })
|
||||
create(@Payload() post: PostDocument) {
|
||||
|
|
|
@ -6,9 +6,9 @@ import { MongooseModule } from '@nestjs/mongoose';
|
|||
|
||||
@Module({
|
||||
imports: [
|
||||
MongooseModule.forFeature([{ name: Post.name, schema: PostSchema }]),
|
||||
MongooseModule.forFeature([{ name: Post.name, schema: PostSchema }]),
|
||||
],
|
||||
controllers: [PostsController],
|
||||
providers: [PostsService]
|
||||
providers: [PostsService],
|
||||
})
|
||||
export class PostsModule {}
|
||||
|
|
|
@ -7,19 +7,16 @@ import { InjectModel } from '@nestjs/mongoose';
|
|||
export class PostsService {
|
||||
constructor(
|
||||
@InjectModel(Post.name) private readonly postModel: Model<PostDocument>,
|
||||
) { }
|
||||
) {}
|
||||
|
||||
async create(post: PostDocument): Promise<Post> {
|
||||
return this.postModel.create(post);
|
||||
}
|
||||
|
||||
async findAll(): Promise<Post[]> {
|
||||
return this.postModel
|
||||
.find()
|
||||
.setOptions({ sanitizeFilter: true })
|
||||
.exec();
|
||||
async findAll(): Promise<Post[]> {
|
||||
return this.postModel.find().setOptions({ sanitizeFilter: true }).exec();
|
||||
}
|
||||
|
||||
|
||||
async findOne(id: string): Promise<Post> {
|
||||
return this.postModel.findOne({ _id: id }).exec();
|
||||
}
|
||||
|
|
|
@ -1,25 +1,21 @@
|
|||
import { Schema, Prop, SchemaFactory } from '@nestjs/mongoose';
|
||||
import { Document, ObjectId } from 'mongoose';
|
||||
|
||||
|
||||
export type CommentDocument = Comment & Document;
|
||||
|
||||
@Schema({ collection: 'comments' })
|
||||
export class Comment {
|
||||
|
||||
@Prop()
|
||||
comment: string;
|
||||
@Prop()
|
||||
comment: string;
|
||||
|
||||
@Prop()
|
||||
date_entry: Date;
|
||||
@Prop()
|
||||
date_entry: Date;
|
||||
|
||||
@Prop()
|
||||
user_id: string
|
||||
|
||||
@Prop()
|
||||
post_id: string;
|
||||
@Prop()
|
||||
user_id: string;
|
||||
|
||||
@Prop()
|
||||
post_id: string;
|
||||
}
|
||||
|
||||
|
||||
export const CommentSchema = SchemaFactory.createForClass(Comment);
|
||||
export const CommentSchema = SchemaFactory.createForClass(Comment);
|
||||
|
|
|
@ -1,24 +1,21 @@
|
|||
import { Schema, Prop, SchemaFactory } from '@nestjs/mongoose';
|
||||
import { Document, ObjectId } from 'mongoose';
|
||||
|
||||
|
||||
export type PostDocument = Post & Document;
|
||||
|
||||
@Schema({ collection: 'posts' })
|
||||
export class Post {
|
||||
|
||||
@Prop()
|
||||
post: string;
|
||||
@Prop()
|
||||
post: string;
|
||||
|
||||
@Prop()
|
||||
date_entry: Date;
|
||||
@Prop()
|
||||
date_entry: Date;
|
||||
|
||||
@Prop()
|
||||
user_id: string
|
||||
@Prop()
|
||||
user_id: string;
|
||||
|
||||
@Prop()
|
||||
community_id: string // id de la comunidad
|
||||
@Prop()
|
||||
community_id: string; // id de la comunidad
|
||||
}
|
||||
|
||||
|
||||
export const PostSchema = SchemaFactory.createForClass(Post);
|
||||
export const PostSchema = SchemaFactory.createForClass(Post);
|
||||
|
|
|
@ -1,23 +1,25 @@
|
|||
import { Module } from '@nestjs/common';
|
||||
import { GuestsModule } from './guests/guests.module';
|
||||
import { MongooseModule } from '@nestjs/mongoose';
|
||||
import { ClientsModule, Transport } from "@nestjs/microservices";
|
||||
|
||||
import { ClientsModule, Transport } from '@nestjs/microservices';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
ClientsModule.register([
|
||||
{
|
||||
name: "SERVICIO_INVITADOS",
|
||||
name: 'SERVICIO_INVITADOS',
|
||||
transport: Transport.TCP,
|
||||
options: {
|
||||
host: "127.0.0.1",
|
||||
port: 3004
|
||||
}
|
||||
}
|
||||
host: '127.0.0.1',
|
||||
port: 3004,
|
||||
},
|
||||
},
|
||||
]),
|
||||
MongooseModule.forRoot(`mongodb+srv://proyecto_4:proyecto_4@proyecto4.yv4fb.mongodb.net/servicio_invitados?retryWrites=true&w=majority`),
|
||||
GuestsModule],
|
||||
MongooseModule.forRoot(
|
||||
`mongodb+srv://proyecto_4:proyecto_4@proyecto4.yv4fb.mongodb.net/servicio_invitados?retryWrites=true&w=majority`,
|
||||
),
|
||||
GuestsModule,
|
||||
],
|
||||
controllers: [],
|
||||
providers: [],
|
||||
})
|
||||
|
|
|
@ -7,34 +7,34 @@ import { Guest, GuestDocument } from 'src/schemas/guest.schema';
|
|||
export class GuestsController {
|
||||
constructor(private readonly guestsService: GuestsService) {}
|
||||
|
||||
@MessagePattern( {cmd:'createGuest'})
|
||||
@MessagePattern({ cmd: 'createGuest' })
|
||||
create(@Payload() guest: GuestDocument) {
|
||||
return this.guestsService.create(guest);
|
||||
}
|
||||
|
||||
@MessagePattern( {cmd:'findAllGuests'})
|
||||
@MessagePattern({ cmd: 'findAllGuests' })
|
||||
findAll() {
|
||||
return this.guestsService.findAll();
|
||||
}
|
||||
|
||||
@MessagePattern( {cmd:'findOneGuest'})
|
||||
@MessagePattern({ cmd: 'findOneGuest' })
|
||||
findOneById(@Payload() id: string) {
|
||||
let _id = id['_id'];
|
||||
return this.guestsService.findOneId(_id);
|
||||
}
|
||||
|
||||
@MessagePattern( {cmd:'findGuestDNI'})
|
||||
@MessagePattern({ cmd: 'findGuestDNI' })
|
||||
findOneByDNI(@Payload() id: string) {
|
||||
let dni = id['dni'];
|
||||
return this.guestsService.findOne(dni);
|
||||
}
|
||||
|
||||
@MessagePattern( {cmd:'updateGuest'})
|
||||
@MessagePattern({ cmd: 'updateGuest' })
|
||||
update(@Payload() guest: GuestDocument) {
|
||||
return this.guestsService.update(guest.id, guest);
|
||||
}
|
||||
|
||||
@MessagePattern( {cmd:'removeGuest'})
|
||||
@MessagePattern({ cmd: 'removeGuest' })
|
||||
remove(@Payload() id: string) {
|
||||
let dni = id['dni'];
|
||||
return this.guestsService.remove(dni);
|
||||
|
|
|
@ -5,9 +5,9 @@ import { MongooseModule } from '@nestjs/mongoose';
|
|||
import { Guest, GuestSchema } from 'src/schemas/guest.schema';
|
||||
@Module({
|
||||
imports: [
|
||||
MongooseModule.forFeature([{ name: Guest.name, schema: GuestSchema }]),
|
||||
MongooseModule.forFeature([{ name: Guest.name, schema: GuestSchema }]),
|
||||
],
|
||||
controllers: [GuestsController],
|
||||
providers: [GuestsService]
|
||||
providers: [GuestsService],
|
||||
})
|
||||
export class GuestsModule {}
|
||||
|
|
|
@ -13,19 +13,14 @@ export class GuestsService {
|
|||
return this.guestModel.create(guest);
|
||||
}
|
||||
|
||||
async findAll(): Promise<Guest[]> {
|
||||
return this.guestModel
|
||||
.find()
|
||||
.setOptions({ sanitizeFilter: true })
|
||||
.exec();
|
||||
async findAll(): Promise<Guest[]> {
|
||||
return this.guestModel.find().setOptions({ sanitizeFilter: true }).exec();
|
||||
}
|
||||
|
||||
|
||||
findOneId(id: string): Promise<Guest> {
|
||||
return this.guestModel.findOne({ _id: id }).exec();
|
||||
}
|
||||
|
||||
|
||||
findOne(id: string): Promise<Guest> {
|
||||
return this.guestModel.findOne({ dni: id }).exec();
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { NestFactory } from "@nestjs/core";
|
||||
import { Transport } from "@nestjs/microservices";
|
||||
import { AppModule } from "./app.module";
|
||||
import { Logger } from "@nestjs/common";
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { Transport } from '@nestjs/microservices';
|
||||
import { AppModule } from './app.module';
|
||||
import { Logger } from '@nestjs/common';
|
||||
|
||||
const logger = new Logger();
|
||||
|
||||
|
@ -9,10 +9,10 @@ async function bootstrap() {
|
|||
const app = await NestFactory.createMicroservice(AppModule, {
|
||||
transport: Transport.TCP,
|
||||
options: {
|
||||
host: "127.0.0.1",
|
||||
port: 3004
|
||||
}
|
||||
host: '127.0.0.1',
|
||||
port: 3004,
|
||||
},
|
||||
});
|
||||
app.listen().then(() => logger.log("Microservice Invitados is listening" ));
|
||||
app.listen().then(() => logger.log('Microservice Invitados is listening'));
|
||||
}
|
||||
bootstrap();
|
||||
bootstrap();
|
||||
|
|
|
@ -1,40 +1,37 @@
|
|||
import { Schema, Prop, SchemaFactory } from '@nestjs/mongoose';
|
||||
import { Document } from 'mongoose';
|
||||
|
||||
|
||||
export type GuestDocument = Guest & Document;
|
||||
|
||||
@Schema({ collection: 'guests' })
|
||||
export class Guest {
|
||||
@Prop()
|
||||
name: string;
|
||||
|
||||
@Prop()
|
||||
name: string;
|
||||
@Prop()
|
||||
last_name: string;
|
||||
|
||||
@Prop()
|
||||
last_name: string;
|
||||
@Prop()
|
||||
dni: string;
|
||||
|
||||
@Prop()
|
||||
dni: string;
|
||||
@Prop()
|
||||
phone: number;
|
||||
|
||||
@Prop()
|
||||
phone: number;
|
||||
@Prop()
|
||||
number_plate: string;
|
||||
|
||||
@Prop()
|
||||
number_plate: string;
|
||||
@Prop()
|
||||
status: string;
|
||||
|
||||
@Prop()
|
||||
status: string;
|
||||
@Prop()
|
||||
date_entry: Date;
|
||||
|
||||
@Prop()
|
||||
date_entry: Date;
|
||||
@Prop()
|
||||
tenant_id: string;
|
||||
|
||||
@Prop()
|
||||
tenant_id: string;
|
||||
|
||||
@Prop()
|
||||
community_id: string; ///creo que se debe de agregar para facilitar al guarda ver
|
||||
// ver los invitados de x comunidad
|
||||
@Prop()
|
||||
community_id: string; ///creo que se debe de agregar para facilitar al guarda ver
|
||||
// ver los invitados de x comunidad
|
||||
}
|
||||
|
||||
|
||||
export const GuestSchema = SchemaFactory.createForClass(Guest);
|
||||
export const GuestSchema = SchemaFactory.createForClass(Guest);
|
||||
|
|
|
@ -6,6 +6,6 @@ export class AppController {
|
|||
|
||||
@Get()
|
||||
getHello(): string {
|
||||
return "hola";
|
||||
return 'hola';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
import { Module } from '@nestjs/common';
|
||||
import { AppController } from './app.controller';
|
||||
import { MailerModule } from '@nestjs-modules/mailer';
|
||||
import { ClientsModule, Transport } from "@nestjs/microservices";
|
||||
import { ClientsModule, Transport } from '@nestjs/microservices';
|
||||
import { AuthModule } from './auth/auth.module';
|
||||
import { EmailController } from './email.controller';
|
||||
import { join } from 'path';
|
||||
import { HandlebarsAdapter } from '@nestjs-modules/mailer/dist/adapters/handlebars.adapter';
|
||||
import { ConfigModule, ConfigService } from '@nestjs/config';
|
||||
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
MailerModule.forRootAsync({
|
||||
|
@ -42,15 +41,16 @@ import { ConfigModule, ConfigService } from '@nestjs/config';
|
|||
}),
|
||||
ClientsModule.register([
|
||||
{
|
||||
name: "SERVICIO_NOTIFICACIONES",
|
||||
name: 'SERVICIO_NOTIFICACIONES',
|
||||
transport: Transport.TCP,
|
||||
options: {
|
||||
host: "127.0.0.1",
|
||||
port: 3009
|
||||
}
|
||||
}
|
||||
host: '127.0.0.1',
|
||||
port: 3009,
|
||||
},
|
||||
},
|
||||
]),
|
||||
AuthModule],
|
||||
AuthModule,
|
||||
],
|
||||
controllers: [AppController, EmailController],
|
||||
providers: [],
|
||||
})
|
||||
|
|
|
@ -3,11 +3,10 @@ import { User } from './../user/user.entity';
|
|||
|
||||
@Injectable()
|
||||
export class AuthService {
|
||||
|
||||
async signUp(user: User) {
|
||||
const token = Math.floor(1000 + Math.random() * 9000).toString();
|
||||
// create user in db
|
||||
// ...
|
||||
// send confirmation mail
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,24 +6,23 @@ import { User } from './user/user.entity';
|
|||
|
||||
@Controller()
|
||||
export class EmailController {
|
||||
constructor(private mailService: MailerService) { }
|
||||
constructor(private mailService: MailerService) {}
|
||||
|
||||
@MessagePattern({ cmd: 'sendMail' })
|
||||
sendMail(@Payload() toEmail: string) {
|
||||
|
||||
var response = this.mailService.sendMail({
|
||||
to: toEmail["email"],
|
||||
from: "mbonilla.guti@gmail.com",
|
||||
subject: 'Plain Text Email ✔',
|
||||
text: 'Welcome NestJS Email Sending Tutorial',
|
||||
});
|
||||
return response;
|
||||
}
|
||||
@MessagePattern({ cmd: 'sendMail' })
|
||||
sendMail(@Payload() toEmail: string) {
|
||||
var response = this.mailService.sendMail({
|
||||
to: toEmail['email'],
|
||||
from: 'mbonilla.guti@gmail.com',
|
||||
subject: 'Plain Text Email ✔',
|
||||
text: 'Welcome NestJS Email Sending Tutorial',
|
||||
});
|
||||
return response;
|
||||
}
|
||||
|
||||
@MessagePattern({ cmd: 'html' })
|
||||
async postHTMLEmail(@Payload() user: any) {
|
||||
const url = "http://localhost:3000/";
|
||||
const image = "images/email.ong";
|
||||
const url = "http://localhost:3000/";
|
||||
const image = "images/email.png";
|
||||
var response = await this.mailService.sendMail({
|
||||
to: user["email"],
|
||||
from: "mbonilla.guti@gmail.com",
|
||||
|
@ -36,9 +35,44 @@ export class EmailController {
|
|||
attachments: [
|
||||
{
|
||||
filename: 'email.png',
|
||||
path: __dirname +'/mails/images/email.png',
|
||||
path: __dirname + '/mails/images/email.png',
|
||||
cid: 'logo' //my mistake was putting "cid:logo@cid" here!
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
@MessagePattern({ cmd: 'emailCreateUserAdminCommunity' })
|
||||
async emailCreateUserAdmin(@Payload() user: any) {
|
||||
const url = "http://localhost:3000/";
|
||||
const image = "images/email.png";
|
||||
const logo = "images/Logo Katoikia.png";
|
||||
var response = await this.mailService.sendMail({
|
||||
to: user["email"],
|
||||
from: "mbonilla.guti@gmail.com",
|
||||
subject: 'Usuario registrado',
|
||||
template: 'emailCreateUserAdminCommunity',
|
||||
context: {
|
||||
name: user["name"],
|
||||
password: user["password"],
|
||||
date_entry: user["date_entry"],
|
||||
email: user["email"],
|
||||
community_name: user['community_name'],
|
||||
url
|
||||
},
|
||||
attachments: [
|
||||
{
|
||||
filename: 'email.png',
|
||||
path: __dirname + '/mails/images/email.png',
|
||||
cid: 'image_email' //my mistake was putting "cid:logo@cid" here!
|
||||
},
|
||||
{
|
||||
filename: 'Logo_Katoikia.png',
|
||||
path: __dirname + '/mails/images/Logo_Katoikia.png',
|
||||
cid: 'logoKatoikia' //my mistake was putting "cid:logo@cid" here!
|
||||
}
|
||||
]
|
||||
});
|
||||
return response;
|
||||
|
|
|
@ -0,0 +1,457 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml"
|
||||
xmlns:o="urn:schemas-microsoft-com:office:office">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8"> <!-- utf-8 works for most cases -->
|
||||
<meta name="viewport" content="width=device-width"> <!-- Forcing initial-scale shouldn't be necessary -->
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <!-- Use the latest (edge) version of IE rendering engine -->
|
||||
<meta name="x-apple-disable-message-reformatting"> <!-- Disable auto-scale in iOS 10 Mail entirely -->
|
||||
<title></title> <!-- The title tag shows in email notifications, like Android 4.4. -->
|
||||
|
||||
<link href="https://fonts.googleapis.com/css?family=Lato:300,400,700" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.2/css/all.min.css"
|
||||
integrity="sha512-1sCRPdkRXhBV2PBLUdRb4tMg1w2YPf37qatUFeS7zlBy7jJI8Lf4VHwWfZZfpXtYSLy85pkm9GaYVYMfw5BC1A=="
|
||||
crossorigin="anonymous" referrerpolicy="no-referrer" />
|
||||
|
||||
|
||||
<!-- CSS Reset : BEGIN -->
|
||||
<style>
|
||||
html,
|
||||
body {
|
||||
margin: 0 auto !important;
|
||||
padding: 0 !important;
|
||||
height: 100% !important;
|
||||
width: 100% !important;
|
||||
background: #f1f1f1;
|
||||
}
|
||||
|
||||
/* What it does: Stops email clients resizing small text. */
|
||||
* {
|
||||
-ms-text-size-adjust: 100%;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
}
|
||||
|
||||
/* What it does: Centers email on Android 4.4 */
|
||||
div[style*="margin: 16px 0"] {
|
||||
margin: 0 !important;
|
||||
}
|
||||
|
||||
/* What it does: Stops Outlook from adding extra spacing to tables. */
|
||||
table,
|
||||
td {
|
||||
mso-table-lspace: 0pt !important;
|
||||
mso-table-rspace: 0pt !important;
|
||||
}
|
||||
|
||||
/* What it does: Fixes webkit padding issue. */
|
||||
table {
|
||||
border-spacing: 0 !important;
|
||||
border-collapse: collapse !important;
|
||||
table-layout: fixed !important;
|
||||
margin: 0 auto !important;
|
||||
}
|
||||
|
||||
/* What it does: Uses a better rendering method when resizing images in IE. */
|
||||
img {
|
||||
-ms-interpolation-mode: bicubic;
|
||||
}
|
||||
|
||||
/* What it does: Prevents Windows 10 Mail from underlining links despite inline CSS. Styles for underlined links should be inline. */
|
||||
a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/* What it does: A work-around for email clients meddling in triggered links. */
|
||||
*[x-apple-data-detectors],
|
||||
/* iOS */
|
||||
.unstyle-auto-detected-links *,
|
||||
.aBn {
|
||||
border-bottom: 0 !important;
|
||||
cursor: default !important;
|
||||
color: inherit !important;
|
||||
text-decoration: none !important;
|
||||
font-size: inherit !important;
|
||||
font-family: inherit !important;
|
||||
font-weight: inherit !important;
|
||||
line-height: inherit !important;
|
||||
}
|
||||
|
||||
/* What it does: Prevents Gmail from displaying a download button on large, non-linked images. */
|
||||
.a6S {
|
||||
display: none !important;
|
||||
opacity: 0.01 !important;
|
||||
}
|
||||
|
||||
/* What it does: Prevents Gmail from changing the text color in conversation threads. */
|
||||
.im {
|
||||
color: inherit !important;
|
||||
}
|
||||
|
||||
/* If the above doesn't work, add a .g-img class to any image in question. */
|
||||
img.g-img+div {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* What it does: Removes right gutter in Gmail iOS app: https://github.com/TedGoas/Cerberus/issues/89 */
|
||||
/* Create one of these media queries for each additional viewport size you'd like to fix */
|
||||
|
||||
/* iPhone 4, 4S, 5, 5S, 5C, and 5SE */
|
||||
@media only screen and (min-device-width: 320px) and (max-device-width: 374px) {
|
||||
u~div .email-container {
|
||||
min-width: 320px !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* iPhone 6, 6S, 7, 8, and X */
|
||||
@media only screen and (min-device-width: 375px) and (max-device-width: 413px) {
|
||||
u~div .email-container {
|
||||
min-width: 375px !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* iPhone 6+, 7+, and 8+ */
|
||||
@media only screen and (min-device-width: 414px) {
|
||||
u~div .email-container {
|
||||
min-width: 414px !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- CSS Reset : END -->
|
||||
|
||||
<!-- Progressive Enhancements : BEGIN -->
|
||||
<style>
|
||||
.primary {
|
||||
background: #D7A86E;
|
||||
}
|
||||
|
||||
.bg_white {
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
.bg_light {
|
||||
background: #fafafa;
|
||||
}
|
||||
|
||||
.bg_black {
|
||||
background: #000000;
|
||||
}
|
||||
|
||||
.bg_dark {
|
||||
background: rgba(0, 0, 0, .8);
|
||||
}
|
||||
|
||||
.email-section {
|
||||
padding: 2.5em;
|
||||
}
|
||||
|
||||
/*BUTTON*/
|
||||
.btn {
|
||||
padding: 10px 15px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.btn.btn-primary {
|
||||
border-radius: 5px;
|
||||
background: #D7A86E;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.btn.btn-white {
|
||||
border-radius: 5px;
|
||||
background: #ffffff;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.btn.btn-white-outline {
|
||||
border-radius: 5px;
|
||||
background: transparent;
|
||||
border: 1px solid #fff;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.btn.btn-black-outline {
|
||||
border-radius: 0px;
|
||||
background: transparent;
|
||||
border: 2px solid #000;
|
||||
color: #000;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
font-family: 'Lato', sans-serif;
|
||||
color: #000000;
|
||||
margin-top: 0;
|
||||
font-weight: 400;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'Lato', sans-serif;
|
||||
font-weight: 400;
|
||||
font-size: 15px;
|
||||
line-height: 1.8;
|
||||
color: rgba(0, 0, 0, 0.808);
|
||||
}
|
||||
|
||||
a {
|
||||
color: #D7A86E;
|
||||
}
|
||||
|
||||
table {}
|
||||
|
||||
/*LOGO*/
|
||||
|
||||
.logo h1 {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.logo h1 a {
|
||||
color: #D7A86E;
|
||||
font-size: 24px;
|
||||
font-weight: 700;
|
||||
font-family: 'Lato', sans-serif;
|
||||
}
|
||||
|
||||
/*HERO*/
|
||||
.hero {
|
||||
position: relative;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.hero .text {
|
||||
color: rgba(0, 0, 0, 0.884);
|
||||
}
|
||||
|
||||
.hero .text h2 {
|
||||
color: #000;
|
||||
font-size: 40px;
|
||||
margin-bottom: 0;
|
||||
font-weight: 400;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.hero .text h3 {
|
||||
font-size: 24px;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
.hero .text h2 span {
|
||||
font-weight: 600;
|
||||
color: #D7A86E;
|
||||
}
|
||||
|
||||
|
||||
/*HEADING SECTION*/
|
||||
.heading-section {}
|
||||
|
||||
.heading-section h2 {
|
||||
color: #000000;
|
||||
font-size: 28px;
|
||||
margin-top: 0;
|
||||
line-height: 1.4;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.heading-section .subheading {
|
||||
margin-bottom: 20px !important;
|
||||
display: inline-block;
|
||||
font-size: 13px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 2px;
|
||||
color: rgba(0, 0, 0, .4);
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.heading-section .subheading::after {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: -10px;
|
||||
content: '';
|
||||
width: 100%;
|
||||
height: 2px;
|
||||
background: #D7A86E;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.heading-section-white {
|
||||
color: rgba(255, 255, 255, .8);
|
||||
}
|
||||
|
||||
.heading-section-white h2 {
|
||||
line-height: 1;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
.heading-section-white h2 {
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.heading-section-white .subheading {
|
||||
margin-bottom: 0;
|
||||
display: inline-block;
|
||||
font-size: 13px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 2px;
|
||||
color: rgba(255, 255, 255, .4);
|
||||
}
|
||||
|
||||
|
||||
ul.social {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
ul.social li {
|
||||
display: inline-block;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
/*FOOTER*/
|
||||
|
||||
.footer {
|
||||
border-top: 1px solid rgba(0, 0, 0, .05);
|
||||
color: rgba(0, 0, 0, .5);
|
||||
}
|
||||
|
||||
.footer .heading {
|
||||
color: #000;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.footer ul {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.footer ul li {
|
||||
list-style: none;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.footer ul li a {
|
||||
color: rgba(0, 0, 0, 1);
|
||||
}
|
||||
|
||||
|
||||
@media screen and (max-width: 500px) {}
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body width="100%" style="margin: 0; padding: 0 !important; mso-line-height-rule: exactly; background-color: #f1f1f1;">
|
||||
<center style="width: 100%; background-color: #f1f1f1;">
|
||||
<div
|
||||
style="display: none; font-size: 1px;max-height: 0px; max-width: 0px; opacity: 0; overflow: hidden; mso-hide: all; font-family: sans-serif;">
|
||||
‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌
|
||||
</div>
|
||||
<div style="max-width: 600px; margin: 0 auto;" class="email-container">
|
||||
<!-- BEGIN BODY -->
|
||||
<table align="center" role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%"
|
||||
style="margin: auto;">
|
||||
<tr>
|
||||
<td valign="top" class="bg_white" style="padding: 1em 2.5em 0 2.5em;">
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
|
||||
<td class="logo" style="text-align: right;">
|
||||
<img src="cid:logoLatoikia" alt="Logo Katoikia"
|
||||
style="width: 60px; max-width: 60px; height: auto; margin: auto; display: block; float: right;">
|
||||
</td>
|
||||
<td class="logo" style="text-align: left;">
|
||||
<h1><a href="#">Katoikia</a></h1>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
</tr><!-- end tr -->
|
||||
<tr>
|
||||
<td valign="middle" class="hero bg_white" style="padding: 3em 0 2em 0;">
|
||||
<img src="cid:image_email" alt="Logo Katoikia"
|
||||
style="width: 150px; max-width: 300px; height: auto; margin: auto; display: block;">
|
||||
</td>
|
||||
</tr><!-- end tr -->
|
||||
<tr>
|
||||
<td valign="middle" class="hero bg_white" style="padding: 2em 0 4em 0;">
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="text" style="padding: 0 2.5em; text-align: center;">
|
||||
<h2> Hola , {{ name }} <i class="fa-regular fa-face-smile-wink"
|
||||
style="color:#D7A86E; font-size: 0.8em; margin-left: 20px;"></i></h2>
|
||||
<h3>Ha sido registrado como un Administrador General del sitio web Katoikia</h3>
|
||||
<h4><i class="fa-solid fa-calendar-day"
|
||||
style="color:#D7A86E; margin-right: 10px;"></i> Fecha de registro
|
||||
{{date_entry}}</h4>
|
||||
</div>
|
||||
<div class="text" style="padding: 0 4em; text-align: left;">
|
||||
<h3>Estas son sus credenciales:</h3>
|
||||
<p><i class="fa-regular fa-envelope" style="color:#D7A86E; margin-right: 10px;"></i> Correo electronico: {{email}}</p>
|
||||
<p><i class="fa-solid fa-key" style="color:#D7A86E; margin-right: 10px;"></i> Password: {{password}}</p>
|
||||
|
||||
</div>
|
||||
<div class="text" style="padding: 0 2.5em; text-align: center;">
|
||||
<h3>Inicie sesión en el sitio web para poder acceder y disfrutar todos sus
|
||||
beneficios</h3>
|
||||
<p><a href="{{ url }}" class="btn btn-primary">Iniciar sesión</a></p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr><!-- end tr -->
|
||||
|
||||
<!-- 1 Column Text + Button : END -->
|
||||
</table>
|
||||
<table align="center" role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%"
|
||||
style="margin: auto;">
|
||||
<td valign="middle" class="bg_light footer email-section">
|
||||
<table>
|
||||
<tr>
|
||||
<td valign="top" width="33.333%" style="padding-top: 20px">
|
||||
<table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
|
||||
<tr>
|
||||
<td style="text-align: left; padding-right: 10px">
|
||||
<h3 class="heading">Acerca de</h3>
|
||||
<p>Katoikia es su compañero más cercano para poder estar en contacto con sus vecinos y conocer sobre los mejores anuncios sobre su comunidad.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td valign="top" width="33.333%" style="padding-top: 20px">
|
||||
<table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
|
||||
<tr>
|
||||
<td style="text-align: left; padding-left: 5px; padding-right: 5px">
|
||||
<h3 class="heading">Información de contacto</h3>
|
||||
<ul>
|
||||
<li><span href="mailto:katoikiaapp@gmail.com" class="text">katoikiaapp@gmail.com</span></li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- end: tr -->
|
||||
<tr>
|
||||
<td class="bg_light" style="text-align: center">
|
||||
<p><a href="http://localhost:3000" style="color: rgba(0, 0, 0, 0.8)">katoikiaapp.org</a></p>
|
||||
</td>
|
||||
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</center>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -0,0 +1,464 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml"
|
||||
xmlns:o="urn:schemas-microsoft-com:office:office">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8"> <!-- utf-8 works for most cases -->
|
||||
<meta name="viewport" content="width=device-width"> <!-- Forcing initial-scale shouldn't be necessary -->
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <!-- Use the latest (edge) version of IE rendering engine -->
|
||||
<meta name="x-apple-disable-message-reformatting"> <!-- Disable auto-scale in iOS 10 Mail entirely -->
|
||||
<title></title> <!-- The title tag shows in email notifications, like Android 4.4. -->
|
||||
|
||||
<link href="https://fonts.googleapis.com/css?family=Lato:300,400,700" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.2/css/all.min.css"
|
||||
integrity="sha512-1sCRPdkRXhBV2PBLUdRb4tMg1w2YPf37qatUFeS7zlBy7jJI8Lf4VHwWfZZfpXtYSLy85pkm9GaYVYMfw5BC1A=="
|
||||
crossorigin="anonymous" referrerpolicy="no-referrer" />
|
||||
|
||||
|
||||
<!-- CSS Reset : BEGIN -->
|
||||
<style>
|
||||
html,
|
||||
body {
|
||||
margin: 0 auto !important;
|
||||
padding: 0 !important;
|
||||
height: 100% !important;
|
||||
width: 100% !important;
|
||||
background: #f1f1f1;
|
||||
}
|
||||
|
||||
/* What it does: Stops email clients resizing small text. */
|
||||
* {
|
||||
-ms-text-size-adjust: 100%;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
}
|
||||
|
||||
/* What it does: Centers email on Android 4.4 */
|
||||
div[style*="margin: 16px 0"] {
|
||||
margin: 0 !important;
|
||||
}
|
||||
|
||||
/* What it does: Stops Outlook from adding extra spacing to tables. */
|
||||
table,
|
||||
td {
|
||||
mso-table-lspace: 0pt !important;
|
||||
mso-table-rspace: 0pt !important;
|
||||
}
|
||||
|
||||
/* What it does: Fixes webkit padding issue. */
|
||||
table {
|
||||
border-spacing: 0 !important;
|
||||
border-collapse: collapse !important;
|
||||
table-layout: fixed !important;
|
||||
margin: 0 auto !important;
|
||||
}
|
||||
|
||||
/* What it does: Uses a better rendering method when resizing images in IE. */
|
||||
img {
|
||||
-ms-interpolation-mode: bicubic;
|
||||
}
|
||||
|
||||
/* What it does: Prevents Windows 10 Mail from underlining links despite inline CSS. Styles for underlined links should be inline. */
|
||||
a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/* What it does: A work-around for email clients meddling in triggered links. */
|
||||
*[x-apple-data-detectors],
|
||||
/* iOS */
|
||||
.unstyle-auto-detected-links *,
|
||||
.aBn {
|
||||
border-bottom: 0 !important;
|
||||
cursor: default !important;
|
||||
color: inherit !important;
|
||||
text-decoration: none !important;
|
||||
font-size: inherit !important;
|
||||
font-family: inherit !important;
|
||||
font-weight: inherit !important;
|
||||
line-height: inherit !important;
|
||||
}
|
||||
|
||||
/* What it does: Prevents Gmail from displaying a download button on large, non-linked images. */
|
||||
.a6S {
|
||||
display: none !important;
|
||||
opacity: 0.01 !important;
|
||||
}
|
||||
|
||||
/* What it does: Prevents Gmail from changing the text color in conversation threads. */
|
||||
.im {
|
||||
color: inherit !important;
|
||||
}
|
||||
|
||||
/* If the above doesn't work, add a .g-img class to any image in question. */
|
||||
img.g-img+div {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* What it does: Removes right gutter in Gmail iOS app: https://github.com/TedGoas/Cerberus/issues/89 */
|
||||
/* Create one of these media queries for each additional viewport size you'd like to fix */
|
||||
|
||||
/* iPhone 4, 4S, 5, 5S, 5C, and 5SE */
|
||||
@media only screen and (min-device-width: 320px) and (max-device-width: 374px) {
|
||||
u~div .email-container {
|
||||
min-width: 320px !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* iPhone 6, 6S, 7, 8, and X */
|
||||
@media only screen and (min-device-width: 375px) and (max-device-width: 413px) {
|
||||
u~div .email-container {
|
||||
min-width: 375px !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* iPhone 6+, 7+, and 8+ */
|
||||
@media only screen and (min-device-width: 414px) {
|
||||
u~div .email-container {
|
||||
min-width: 414px !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- CSS Reset : END -->
|
||||
|
||||
<!-- Progressive Enhancements : BEGIN -->
|
||||
<style>
|
||||
.primary {
|
||||
background: #D7A86E;
|
||||
}
|
||||
|
||||
.bg_white {
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
.bg_light {
|
||||
background: #fafafa;
|
||||
}
|
||||
|
||||
.bg_black {
|
||||
background: #000000;
|
||||
}
|
||||
|
||||
.bg_dark {
|
||||
background: rgba(0, 0, 0, .8);
|
||||
}
|
||||
|
||||
.email-section {
|
||||
padding: 2.5em;
|
||||
}
|
||||
|
||||
/*BUTTON*/
|
||||
.btn {
|
||||
padding: 10px 15px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.btn.btn-primary {
|
||||
border-radius: 5px;
|
||||
background: #D7A86E;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.btn.btn-white {
|
||||
border-radius: 5px;
|
||||
background: #ffffff;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.btn.btn-white-outline {
|
||||
border-radius: 5px;
|
||||
background: transparent;
|
||||
border: 1px solid #fff;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.btn.btn-black-outline {
|
||||
border-radius: 0px;
|
||||
background: transparent;
|
||||
border: 2px solid #000;
|
||||
color: #000;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
font-family: 'Lato', sans-serif;
|
||||
color: #000000;
|
||||
margin-top: 0;
|
||||
font-weight: 400;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'Lato', sans-serif;
|
||||
font-weight: 400;
|
||||
font-size: 15px;
|
||||
line-height: 1.8;
|
||||
color: rgba(0, 0, 0, 0.808);
|
||||
}
|
||||
|
||||
a {
|
||||
color: #D7A86E;
|
||||
}
|
||||
|
||||
table {}
|
||||
|
||||
/*LOGO*/
|
||||
|
||||
.logo h1 {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.logo h1 a {
|
||||
color: #D7A86E;
|
||||
font-size: 24px;
|
||||
font-weight: 700;
|
||||
font-family: 'Lato', sans-serif;
|
||||
}
|
||||
|
||||
/*HERO*/
|
||||
.hero {
|
||||
position: relative;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.hero .text {
|
||||
color: rgba(0, 0, 0, 0.884);
|
||||
}
|
||||
|
||||
.hero .text h2 {
|
||||
color: #000;
|
||||
font-size: 40px;
|
||||
margin-bottom: 0;
|
||||
font-weight: 400;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.hero .text h3 {
|
||||
font-size: 24px;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
.hero .text h2 span {
|
||||
font-weight: 600;
|
||||
color: #D7A86E;
|
||||
}
|
||||
|
||||
|
||||
/*HEADING SECTION*/
|
||||
.heading-section {}
|
||||
|
||||
.heading-section h2 {
|
||||
color: #000000;
|
||||
font-size: 28px;
|
||||
margin-top: 0;
|
||||
line-height: 1.4;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.heading-section .subheading {
|
||||
margin-bottom: 20px !important;
|
||||
display: inline-block;
|
||||
font-size: 13px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 2px;
|
||||
color: rgba(0, 0, 0, .4);
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.heading-section .subheading::after {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: -10px;
|
||||
content: '';
|
||||
width: 100%;
|
||||
height: 2px;
|
||||
background: #D7A86E;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.heading-section-white {
|
||||
color: rgba(255, 255, 255, .8);
|
||||
}
|
||||
|
||||
.heading-section-white h2 {
|
||||
line-height: 1;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
.heading-section-white h2 {
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.heading-section-white .subheading {
|
||||
margin-bottom: 0;
|
||||
display: inline-block;
|
||||
font-size: 13px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 2px;
|
||||
color: rgba(255, 255, 255, .4);
|
||||
}
|
||||
|
||||
|
||||
ul.social {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
ul.social li {
|
||||
display: inline-block;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
/*FOOTER*/
|
||||
|
||||
.footer {
|
||||
border-top: 1px solid rgba(0, 0, 0, .05);
|
||||
color: rgba(0, 0, 0, .5);
|
||||
}
|
||||
|
||||
.footer .heading {
|
||||
color: #000;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.footer ul {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.footer ul li {
|
||||
list-style: none;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.footer ul li a {
|
||||
color: rgba(0, 0, 0, 1);
|
||||
}
|
||||
|
||||
|
||||
@media screen and (max-width: 500px) {}
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body width="100%" style="margin: 0; padding: 0 !important; mso-line-height-rule: exactly; background-color: #f1f1f1;">
|
||||
<center style="width: 100%; background-color: #f1f1f1;">
|
||||
<div
|
||||
style="display: none; font-size: 1px;max-height: 0px; max-width: 0px; opacity: 0; overflow: hidden; mso-hide: all; font-family: sans-serif;">
|
||||
‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌
|
||||
</div>
|
||||
<div style="max-width: 600px; margin: 0 auto;" class="email-container">
|
||||
<!-- BEGIN BODY -->
|
||||
<table align="center" role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%"
|
||||
style="margin: auto;">
|
||||
<tr>
|
||||
<td valign="top" class="bg_white" style="padding: 1em 2.5em 0 2.5em;">
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
|
||||
<td class="logo" style="text-align: right;">
|
||||
<img src="cid:logoKatoikia" alt="Logo Katoikia"
|
||||
style="width: 60px; max-width: 60px; height: auto; margin: auto; display: block; float: right;">
|
||||
</td>
|
||||
<td class="logo" style="text-align: left;">
|
||||
<h1><a href="#">Katoikia</a></h1>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
</tr><!-- end tr -->
|
||||
<tr>
|
||||
<td valign="middle" class="hero bg_white" style="padding: 3em 0 2em 0;">
|
||||
<img src="cid:image_email" alt="Logo Katoikia"
|
||||
style="width: 150px; max-width: 300px; height: auto; margin: auto; display: block;">
|
||||
</td>
|
||||
</tr><!-- end tr -->
|
||||
<tr>
|
||||
<td valign="middle" class="hero bg_white" style="padding: 2em 0 4em 0;">
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="text" style="padding: 0 2.5em; text-align: center;">
|
||||
<h2> Hola , {{ name }} <i class="fa-regular fa-face-smile-wink"
|
||||
style="color:#D7A86E; font-size: 0.8em; margin-left: 20px;"></i></h2>
|
||||
<h3>Ha sido registrado como un Administrador de la Comunidad `{{community_name}}`
|
||||
</h3>
|
||||
|
||||
<h4><i class="fa-solid fa-calendar-day"
|
||||
style="color:#D7A86E; margin-right: 10px;"></i> Fecha de registro
|
||||
{{date_entry}}</h4>
|
||||
</div>
|
||||
<div class="text" style="padding: 0 4em; text-align: left;">
|
||||
<h3>Estas son sus credenciales:</h3>
|
||||
<p><i class="fa fa-regular fa-envelope"
|
||||
style="color:#D7A86E; margin-right: 10px;"></i> Correo electronico:
|
||||
{{email}}</p>
|
||||
<p><i class="fa-solid fa-key" style="color:#D7A86E; margin-right: 10px;"></i>
|
||||
Password: {{password}}</p>
|
||||
|
||||
</div>
|
||||
<div class="text" style="padding: 0 2.5em; text-align: center;">
|
||||
<h3>Inicie sesión en el sitio web para poder acceder y disfrutar todos sus
|
||||
beneficios</h3>
|
||||
<p><a href="{{ url }}" class="btn btn-primary">Iniciar sesión</a></p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr><!-- end tr -->
|
||||
|
||||
<!-- 1 Column Text + Button : END -->
|
||||
</table>
|
||||
<table align="center" role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%"
|
||||
style="margin: auto;">
|
||||
<td valign="middle" class="bg_light footer email-section">
|
||||
<table>
|
||||
<tr>
|
||||
<td valign="top" width="33.333%" style="padding-top: 20px">
|
||||
<table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
|
||||
<tr>
|
||||
<td style="text-align: left; padding-right: 10px">
|
||||
<h3 class="heading">Acerca de</h3>
|
||||
<p>Katoikia es su compañero más cercano para poder estar en contacto con sus
|
||||
vecinos y conocer sobre los mejores anuncios sobre su comunidad.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td valign="top" width="33.333%" style="padding-top: 20px">
|
||||
<table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
|
||||
<tr>
|
||||
<td style="text-align: left; padding-left: 5px; padding-right: 5px">
|
||||
<h3 class="heading">Información de contacto</h3>
|
||||
<ul>
|
||||
<li><span href="mailto:katoikiaapp@gmail.com"
|
||||
class="text">katoikiaapp@gmail.com</span></li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- end: tr -->
|
||||
<tr>
|
||||
<td class="bg_light" style="text-align: center">
|
||||
<p><a href="http://localhost:3000" style="color: rgba(0, 0, 0, 0.8)">katoikiaapp.org</a></p>
|
||||
</td>
|
||||
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</center>
|
||||
</body>
|
||||
|
||||
</html>
|
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 66 KiB |
Binary file not shown.
After Width: | Height: | Size: 37 KiB |
|
@ -1,7 +1,7 @@
|
|||
import { NestFactory } from "@nestjs/core";
|
||||
import { Transport } from "@nestjs/microservices";
|
||||
import { AppModule } from "./app.module";
|
||||
import { Logger } from "@nestjs/common";
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { Transport } from '@nestjs/microservices';
|
||||
import { AppModule } from './app.module';
|
||||
import { Logger } from '@nestjs/common';
|
||||
|
||||
const logger = new Logger();
|
||||
|
||||
|
@ -9,10 +9,12 @@ async function bootstrap() {
|
|||
const app = await NestFactory.createMicroservice(AppModule, {
|
||||
transport: Transport.TCP,
|
||||
options: {
|
||||
host: "127.0.0.1",
|
||||
port: 3009
|
||||
}
|
||||
host: '127.0.0.1',
|
||||
port: 3009,
|
||||
},
|
||||
});
|
||||
app.listen().then(() => logger.log("Microservice Notificaciones is listening" ));
|
||||
app
|
||||
.listen()
|
||||
.then(() => logger.log('Microservice Notificaciones is listening'));
|
||||
}
|
||||
bootstrap();
|
||||
bootstrap();
|
||||
|
|
|
@ -8,27 +8,30 @@ import { UpdateNotificationDto } from './dto/update-notification.dto';
|
|||
export class NotificationsController {
|
||||
constructor(private readonly notificationsService: NotificationsService) {}
|
||||
|
||||
@MessagePattern({cmd: 'createNotification'})
|
||||
@MessagePattern({ cmd: 'createNotification' })
|
||||
create(@Payload() createNotificationDto: CreateNotificationDto) {
|
||||
return this.notificationsService.create(createNotificationDto);
|
||||
}
|
||||
|
||||
@MessagePattern({cmd: 'findAllNotifications'})
|
||||
@MessagePattern({ cmd: 'findAllNotifications' })
|
||||
findAll() {
|
||||
return this.notificationsService.findAll();
|
||||
}
|
||||
|
||||
@MessagePattern({cmd: 'findOneNotification'})
|
||||
@MessagePattern({ cmd: 'findOneNotification' })
|
||||
findOne(@Payload() id: number) {
|
||||
return this.notificationsService.findOne(id);
|
||||
}
|
||||
|
||||
@MessagePattern({cmd: 'updateNotification'})
|
||||
@MessagePattern({ cmd: 'updateNotification' })
|
||||
update(@Payload() updateNotificationDto: UpdateNotificationDto) {
|
||||
return this.notificationsService.update(updateNotificationDto.id, updateNotificationDto);
|
||||
return this.notificationsService.update(
|
||||
updateNotificationDto.id,
|
||||
updateNotificationDto,
|
||||
);
|
||||
}
|
||||
|
||||
@MessagePattern({cmd: 'removeNotification'})
|
||||
@MessagePattern({ cmd: 'removeNotification' })
|
||||
remove(@Payload() id: number) {
|
||||
return this.notificationsService.remove(id);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,6 @@ import { NotificationsController } from './notifications.controller';
|
|||
|
||||
@Module({
|
||||
controllers: [NotificationsController],
|
||||
providers: [NotificationsService]
|
||||
providers: [NotificationsService],
|
||||
})
|
||||
export class NotificationsModule {}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export interface User {
|
||||
email: string;
|
||||
name: string;
|
||||
}
|
||||
email: string;
|
||||
name: string;
|
||||
}
|
||||
|
|
|
@ -1,23 +1,25 @@
|
|||
import { Module } from '@nestjs/common';
|
||||
import { PaymentsModule } from './payments/payments.module';
|
||||
import { MongooseModule } from '@nestjs/mongoose';
|
||||
import { ClientsModule, Transport } from "@nestjs/microservices";
|
||||
|
||||
import { ClientsModule, Transport } from '@nestjs/microservices';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
ClientsModule.register([
|
||||
{
|
||||
name: "SERVICIO_PAGOS",
|
||||
name: 'SERVICIO_PAGOS',
|
||||
transport: Transport.TCP,
|
||||
options: {
|
||||
host: "127.0.0.1",
|
||||
port: 3005
|
||||
}
|
||||
}
|
||||
host: '127.0.0.1',
|
||||
port: 3005,
|
||||
},
|
||||
},
|
||||
]),
|
||||
MongooseModule.forRoot(`mongodb+srv://proyecto_4:proyecto_4@proyecto4.yv4fb.mongodb.net/servicio_pagos?retryWrites=true&w=majority`),
|
||||
PaymentsModule],
|
||||
MongooseModule.forRoot(
|
||||
`mongodb+srv://proyecto_4:proyecto_4@proyecto4.yv4fb.mongodb.net/servicio_pagos?retryWrites=true&w=majority`,
|
||||
),
|
||||
PaymentsModule,
|
||||
],
|
||||
controllers: [],
|
||||
providers: [],
|
||||
})
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { NestFactory } from "@nestjs/core";
|
||||
import { Transport } from "@nestjs/microservices";
|
||||
import { AppModule } from "./app.module";
|
||||
import { Logger } from "@nestjs/common";
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { Transport } from '@nestjs/microservices';
|
||||
import { AppModule } from './app.module';
|
||||
import { Logger } from '@nestjs/common';
|
||||
|
||||
const logger = new Logger();
|
||||
|
||||
|
@ -9,10 +9,10 @@ async function bootstrap() {
|
|||
const app = await NestFactory.createMicroservice(AppModule, {
|
||||
transport: Transport.TCP,
|
||||
options: {
|
||||
host: "127.0.0.1",
|
||||
port: 3005
|
||||
}
|
||||
host: '127.0.0.1',
|
||||
port: 3005,
|
||||
},
|
||||
});
|
||||
app.listen().then(() => logger.log("Microservice Invitados is listening" ));
|
||||
app.listen().then(() => logger.log('Microservice Invitados is listening'));
|
||||
}
|
||||
bootstrap();
|
||||
bootstrap();
|
||||
|
|
|
@ -7,40 +7,40 @@ import { Payment, PaymentDocument } from 'src/schemas/payment.schema';
|
|||
export class PaymentsController {
|
||||
constructor(private readonly paymentsService: PaymentsService) {}
|
||||
|
||||
@MessagePattern({cmd: 'createPayment'})
|
||||
@MessagePattern({ cmd: 'createPayment' })
|
||||
create(@Payload() payment: PaymentDocument) {
|
||||
return this.paymentsService.create(payment);
|
||||
}
|
||||
|
||||
@MessagePattern({cmd: 'findAllPayments'})
|
||||
@MessagePattern({ cmd: 'findAllPayments' })
|
||||
findAll() {
|
||||
return this.paymentsService.findAll();
|
||||
}
|
||||
|
||||
@MessagePattern({cmd: 'findOnePayment'})
|
||||
@MessagePattern({ cmd: 'findOnePayment' })
|
||||
findOne(@Payload() id: string) {
|
||||
let _id = id['_id'];
|
||||
return this.paymentsService.findOneId(_id);
|
||||
}
|
||||
|
||||
@MessagePattern({cmd: 'findPaymentsByUser'})
|
||||
@MessagePattern({ cmd: 'findPaymentsByUser' })
|
||||
findByUser(@Payload() id: string) {
|
||||
let user_id = id['user_id'];
|
||||
return this.paymentsService.findByUser(user_id);
|
||||
}
|
||||
|
||||
@MessagePattern({cmd: 'findPaymentsByCommunity'})
|
||||
@MessagePattern({ cmd: 'findPaymentsByCommunity' })
|
||||
findByCommunity(@Payload() id: string) {
|
||||
let community_id = id['community_id'];
|
||||
return this.paymentsService.findByUser(community_id);
|
||||
}
|
||||
|
||||
@MessagePattern({cmd: 'updatePayment'})
|
||||
@MessagePattern({ cmd: 'updatePayment' })
|
||||
update(@Payload() payment: PaymentDocument) {
|
||||
return this.paymentsService.update(payment.id, payment);
|
||||
}
|
||||
|
||||
@MessagePattern({cmd: 'removePayment'})
|
||||
@MessagePattern({ cmd: 'removePayment' })
|
||||
remove(@Payload() id: string) {
|
||||
let _id = id['_id'];
|
||||
return this.paymentsService.remove(_id);
|
||||
|
|
|
@ -4,12 +4,11 @@ import { PaymentsController } from './payments.controller';
|
|||
import { MongooseModule } from '@nestjs/mongoose';
|
||||
import { Payment, PaymentSchema } from 'src/schemas/payment.schema';
|
||||
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
MongooseModule.forFeature([{ name: Payment.name, schema: PaymentSchema }]),
|
||||
MongooseModule.forFeature([{ name: Payment.name, schema: PaymentSchema }]),
|
||||
],
|
||||
controllers: [PaymentsController],
|
||||
providers: [PaymentsService]
|
||||
providers: [PaymentsService],
|
||||
})
|
||||
export class PaymentsModule {}
|
||||
|
|
|
@ -3,30 +3,25 @@ import { Payment, PaymentDocument } from 'src/schemas/payment.schema';
|
|||
import { Model } from 'mongoose';
|
||||
import { InjectModel } from '@nestjs/mongoose';
|
||||
|
||||
|
||||
@Injectable()
|
||||
export class PaymentsService {
|
||||
constructor(
|
||||
@InjectModel(Payment.name) private readonly paymentModel: Model<PaymentDocument>,
|
||||
@InjectModel(Payment.name)
|
||||
private readonly paymentModel: Model<PaymentDocument>,
|
||||
) {}
|
||||
|
||||
async create(payment: PaymentDocument): Promise<Payment> {
|
||||
return this.paymentModel.create(payment);
|
||||
}
|
||||
|
||||
async findAll(): Promise<Payment[]> {
|
||||
return this.paymentModel
|
||||
.find()
|
||||
.setOptions({ sanitizeFilter: true })
|
||||
.exec();
|
||||
async findAll(): Promise<Payment[]> {
|
||||
return this.paymentModel.find().setOptions({ sanitizeFilter: true }).exec();
|
||||
}
|
||||
|
||||
|
||||
findOneId(id: string): Promise<Payment> {
|
||||
return this.paymentModel.findOne({ _id: id }).exec();
|
||||
}
|
||||
|
||||
|
||||
findByUser(id: string): Promise<Payment> {
|
||||
return this.paymentModel.findOne({ user_id: id }).exec();
|
||||
}
|
||||
|
|
|
@ -1,33 +1,30 @@
|
|||
|
||||
import { Schema, Prop, SchemaFactory } from '@nestjs/mongoose';
|
||||
import { Document } from 'mongoose';
|
||||
|
||||
|
||||
export type PaymentDocument = Payment & Document;
|
||||
|
||||
@Schema({ collection: 'payments' })
|
||||
export class Payment {
|
||||
@Prop()
|
||||
date_payment: Date;
|
||||
|
||||
@Prop()
|
||||
date_payment: Date;
|
||||
@Prop()
|
||||
mount: number;
|
||||
|
||||
@Prop()
|
||||
mount: number;
|
||||
@Prop()
|
||||
description: string;
|
||||
|
||||
@Prop()
|
||||
description: string;
|
||||
@Prop()
|
||||
period: string;
|
||||
|
||||
@Prop()
|
||||
period: string;
|
||||
@Prop()
|
||||
status: string;
|
||||
|
||||
@Prop()
|
||||
status: string;
|
||||
@Prop()
|
||||
user_id: string;
|
||||
|
||||
@Prop()
|
||||
user_id: string;
|
||||
|
||||
@Prop()
|
||||
communty_id: string;
|
||||
@Prop()
|
||||
communty_id: string;
|
||||
}
|
||||
|
||||
export const PaymentSchema = SchemaFactory.createForClass(Payment);
|
||||
export const PaymentSchema = SchemaFactory.createForClass(Payment);
|
||||
|
|
|
@ -1,25 +1,26 @@
|
|||
import { Module } from '@nestjs/common';
|
||||
import { ReportsModule } from './reports/reports.module';
|
||||
import { MongooseModule } from '@nestjs/mongoose';
|
||||
import { ClientsModule, Transport } from "@nestjs/microservices";
|
||||
|
||||
|
||||
import { ClientsModule, Transport } from '@nestjs/microservices';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
ClientsModule.register([
|
||||
{
|
||||
name: "SERVICIO_REPORTES",
|
||||
name: 'SERVICIO_REPORTES',
|
||||
transport: Transport.TCP,
|
||||
options: {
|
||||
host: "127.0.0.1",
|
||||
port: 3008
|
||||
}
|
||||
}
|
||||
host: '127.0.0.1',
|
||||
port: 3008,
|
||||
},
|
||||
},
|
||||
]),
|
||||
MongooseModule.forRoot(`mongodb+srv://proyecto_4:proyecto_4@proyecto4.yv4fb.mongodb.net/servicio_reportes?retryWrites=true&w=majority`),
|
||||
ReportsModule],
|
||||
MongooseModule.forRoot(
|
||||
`mongodb+srv://proyecto_4:proyecto_4@proyecto4.yv4fb.mongodb.net/servicio_reportes?retryWrites=true&w=majority`,
|
||||
),
|
||||
ReportsModule,
|
||||
],
|
||||
controllers: [],
|
||||
providers: [],
|
||||
})
|
||||
export class AppModule { }
|
||||
export class AppModule {}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { NestFactory } from "@nestjs/core";
|
||||
import { Transport } from "@nestjs/microservices";
|
||||
import { AppModule } from "./app.module";
|
||||
import { Logger } from "@nestjs/common";
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { Transport } from '@nestjs/microservices';
|
||||
import { AppModule } from './app.module';
|
||||
import { Logger } from '@nestjs/common';
|
||||
|
||||
const logger = new Logger();
|
||||
|
||||
|
@ -9,10 +9,10 @@ async function bootstrap() {
|
|||
const app = await NestFactory.createMicroservice(AppModule, {
|
||||
transport: Transport.TCP,
|
||||
options: {
|
||||
host: "127.0.0.1",
|
||||
port: 3008
|
||||
}
|
||||
host: '127.0.0.1',
|
||||
port: 3008,
|
||||
},
|
||||
});
|
||||
app.listen().then(() => logger.log("Microservice Reportes is listening" ));
|
||||
app.listen().then(() => logger.log('Microservice Reportes is listening'));
|
||||
}
|
||||
bootstrap();
|
||||
bootstrap();
|
||||
|
|
|
@ -7,7 +7,6 @@ import { Report, ReportDocument } from '../schemas/report.schema';
|
|||
export class ReportsController {
|
||||
constructor(private readonly reportsService: ReportsService) {}
|
||||
|
||||
|
||||
@MessagePattern({ cmd: 'createReport' })
|
||||
create(@Payload() report: ReportDocument) {
|
||||
return this.reportsService.create(report);
|
||||
|
|
|
@ -6,9 +6,9 @@ import { Report, ReportSchema } from '../schemas/report.schema';
|
|||
|
||||
@Module({
|
||||
imports: [
|
||||
MongooseModule.forFeature([{ name: Report.name, schema:ReportSchema }]),
|
||||
MongooseModule.forFeature([{ name: Report.name, schema: ReportSchema }]),
|
||||
],
|
||||
controllers: [ReportsController],
|
||||
providers: [ReportsService]
|
||||
providers: [ReportsService],
|
||||
})
|
||||
export class ReportsModule {}
|
||||
|
|
|
@ -1,34 +1,29 @@
|
|||
import { Injectable, Inject } from '@nestjs/common';
|
||||
import { ClientProxy } from "@nestjs/microservices";
|
||||
import { ClientProxy } from '@nestjs/microservices';
|
||||
import { Model } from 'mongoose';
|
||||
import { InjectModel } from '@nestjs/mongoose';
|
||||
import { Report, ReportDocument } from '../schemas/report.schema';
|
||||
import { map } from "rxjs/operators";
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
@Injectable()
|
||||
export class ReportsService {
|
||||
constructor(
|
||||
@InjectModel(Report.name) private readonly reportModel: Model<ReportDocument>,
|
||||
|
||||
//
|
||||
) { }
|
||||
@InjectModel(Report.name)
|
||||
private readonly reportModel: Model<ReportDocument>, //
|
||||
) {}
|
||||
|
||||
async create(report: ReportDocument): Promise<Report> {
|
||||
return this.reportModel.create(report);
|
||||
}
|
||||
|
||||
async findAll(): Promise<Report[]> {
|
||||
return this.reportModel
|
||||
.find()
|
||||
.setOptions({ sanitizeFilter: true })
|
||||
.exec();
|
||||
return this.reportModel.find().setOptions({ sanitizeFilter: true }).exec();
|
||||
}
|
||||
|
||||
async findOne(id: string): Promise<Report> {
|
||||
return this.reportModel.findOne({ _id: id }).exec();
|
||||
}
|
||||
|
||||
|
||||
async update(id: string, report: ReportDocument) {
|
||||
return this.reportModel.findOneAndUpdate({ _id: id }, report, {
|
||||
new: true,
|
||||
|
|
|
@ -1,24 +1,21 @@
|
|||
import { Schema, Prop, SchemaFactory } from '@nestjs/mongoose';
|
||||
import { Document, ObjectId } from 'mongoose';
|
||||
|
||||
|
||||
export type ReportDocument = Report & Document;
|
||||
|
||||
@Schema({ collection: 'reports' })
|
||||
export class Report {
|
||||
|
||||
@Prop()
|
||||
action: string;
|
||||
|
||||
@Prop()
|
||||
description: string;
|
||||
@Prop()
|
||||
action: string;
|
||||
|
||||
@Prop()
|
||||
date_entry: Date;
|
||||
@Prop()
|
||||
description: string;
|
||||
|
||||
@Prop()
|
||||
user_id: string
|
||||
@Prop()
|
||||
date_entry: Date;
|
||||
|
||||
@Prop()
|
||||
user_id: string;
|
||||
}
|
||||
|
||||
|
||||
export const ReportSchema = SchemaFactory.createForClass(Report);
|
||||
export const ReportSchema = SchemaFactory.createForClass(Report);
|
||||
|
|
|
@ -1,22 +1,25 @@
|
|||
import { Module } from '@nestjs/common';
|
||||
import { ReservationsModule } from './reservations/reservations.module';
|
||||
import { ClientsModule, Transport } from "@nestjs/microservices";
|
||||
import { ClientsModule, Transport } from '@nestjs/microservices';
|
||||
import { MongooseModule } from '@nestjs/mongoose';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
ClientsModule.register([
|
||||
{
|
||||
name: "SERVICIO_RESERVACIONES",
|
||||
name: 'SERVICIO_RESERVACIONES',
|
||||
transport: Transport.TCP,
|
||||
options: {
|
||||
host: "127.0.0.1",
|
||||
port: 3006
|
||||
}
|
||||
}
|
||||
host: '127.0.0.1',
|
||||
port: 3006,
|
||||
},
|
||||
},
|
||||
]),
|
||||
MongooseModule.forRoot(`mongodb+srv://proyecto_4:proyecto_4@proyecto4.yv4fb.mongodb.net/servicio_reservaciones?retryWrites=true&w=majority`),
|
||||
ReservationsModule],
|
||||
MongooseModule.forRoot(
|
||||
`mongodb+srv://proyecto_4:proyecto_4@proyecto4.yv4fb.mongodb.net/servicio_reservaciones?retryWrites=true&w=majority`,
|
||||
),
|
||||
ReservationsModule,
|
||||
],
|
||||
controllers: [],
|
||||
providers: [],
|
||||
})
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { NestFactory } from "@nestjs/core";
|
||||
import { Transport } from "@nestjs/microservices";
|
||||
import { AppModule } from "./app.module";
|
||||
import { Logger } from "@nestjs/common";
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { Transport } from '@nestjs/microservices';
|
||||
import { AppModule } from './app.module';
|
||||
import { Logger } from '@nestjs/common';
|
||||
|
||||
const logger = new Logger();
|
||||
|
||||
|
@ -9,10 +9,12 @@ async function bootstrap() {
|
|||
const app = await NestFactory.createMicroservice(AppModule, {
|
||||
transport: Transport.TCP,
|
||||
options: {
|
||||
host: "127.0.0.1",
|
||||
port: 3006
|
||||
}
|
||||
host: '127.0.0.1',
|
||||
port: 3006,
|
||||
},
|
||||
});
|
||||
app.listen().then(() => logger.log("Microservice Reservaciones is listening" ));
|
||||
app
|
||||
.listen()
|
||||
.then(() => logger.log('Microservice Reservaciones is listening'));
|
||||
}
|
||||
bootstrap();
|
||||
bootstrap();
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
import { Controller } from '@nestjs/common';
|
||||
import { MessagePattern, Payload } from '@nestjs/microservices';
|
||||
import { ReservationsService } from './reservations.service';
|
||||
import { Reservation, ReservationDocument } from '../schemas/reservation.schema';
|
||||
import {
|
||||
Reservation,
|
||||
ReservationDocument,
|
||||
} from '../schemas/reservation.schema';
|
||||
|
||||
@Controller()
|
||||
export class ReservationsController {
|
||||
constructor(private readonly reservationsService: ReservationsService) { }
|
||||
constructor(private readonly reservationsService: ReservationsService) {}
|
||||
|
||||
@MessagePattern({ cmd: 'createReservation' })
|
||||
create(@Payload() reservation: ReservationDocument) {
|
||||
|
|
|
@ -3,13 +3,15 @@ import { ReservationsService } from './reservations.service';
|
|||
import { MongooseModule } from '@nestjs/mongoose';
|
||||
|
||||
import { ReservationsController } from './reservations.controller';
|
||||
import { Reservation, ReservationSchema} from '../schemas/reservation.schema';
|
||||
import { Reservation, ReservationSchema } from '../schemas/reservation.schema';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
MongooseModule.forFeature([{ name: Reservation.name, schema: ReservationSchema }]),
|
||||
MongooseModule.forFeature([
|
||||
{ name: Reservation.name, schema: ReservationSchema },
|
||||
]),
|
||||
],
|
||||
controllers: [ReservationsController],
|
||||
providers: [ReservationsService]
|
||||
providers: [ReservationsService],
|
||||
})
|
||||
export class ReservationsModule {}
|
||||
|
|
|
@ -1,12 +1,16 @@
|
|||
import { Injectable } from '@nestjs/common';
|
||||
import { Reservation, ReservationDocument} from '../schemas/reservation.schema';
|
||||
import {
|
||||
Reservation,
|
||||
ReservationDocument,
|
||||
} from '../schemas/reservation.schema';
|
||||
import { Model } from 'mongoose';
|
||||
import { InjectModel } from '@nestjs/mongoose';
|
||||
|
||||
@Injectable()
|
||||
export class ReservationsService {
|
||||
constructor(
|
||||
@InjectModel(Reservation.name) private readonly reservationModel: Model<ReservationDocument>,
|
||||
@InjectModel(Reservation.name)
|
||||
private readonly reservationModel: Model<ReservationDocument>,
|
||||
) {}
|
||||
|
||||
create(reservation: ReservationDocument) {
|
||||
|
@ -15,10 +19,10 @@ export class ReservationsService {
|
|||
return this.reservationModel.create(reservation);
|
||||
}
|
||||
|
||||
async findAll(): Promise<Reservation[]> {
|
||||
async findAll(): Promise<Reservation[]> {
|
||||
return this.reservationModel
|
||||
.find()
|
||||
.setOptions({ sanitizeFilter: true })
|
||||
.find()
|
||||
.setOptions({ sanitizeFilter: true })
|
||||
.exec();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,30 +1,27 @@
|
|||
import { Schema, Prop, SchemaFactory } from '@nestjs/mongoose';
|
||||
import { Document, ObjectId } from 'mongoose';
|
||||
|
||||
|
||||
export type ReservationDocument = Reservation & Document;
|
||||
|
||||
@Schema({ collection: 'reservations' })
|
||||
export class Reservation {
|
||||
|
||||
@Prop()
|
||||
start_time: string;
|
||||
@Prop()
|
||||
start_time: string;
|
||||
|
||||
@Prop()
|
||||
finish_time: string;
|
||||
@Prop()
|
||||
finish_time: string;
|
||||
|
||||
@Prop()
|
||||
status: string;
|
||||
@Prop()
|
||||
status: string;
|
||||
|
||||
@Prop()
|
||||
date_entry: Date;
|
||||
@Prop()
|
||||
date_entry: Date;
|
||||
|
||||
@Prop()
|
||||
common_area_id: string;
|
||||
@Prop()
|
||||
common_area_id: string;
|
||||
|
||||
@Prop()
|
||||
user_id: string
|
||||
@Prop()
|
||||
user_id: string;
|
||||
}
|
||||
|
||||
|
||||
export const ReservationSchema = SchemaFactory.createForClass(Reservation);
|
||||
export const ReservationSchema = SchemaFactory.createForClass(Reservation);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -29,10 +29,12 @@
|
|||
"@nestjs/platform-express": "^8.0.0",
|
||||
"@nestjs/swagger": "^5.2.1",
|
||||
"buffer": "^5.7.1",
|
||||
"class-validator": "^0.13.2",
|
||||
"cors": "^2.8.5",
|
||||
"crypto-browserify": "^3.12.0",
|
||||
"md5-typescript": "^1.0.5",
|
||||
"mongoose": "^6.4.1",
|
||||
"mongoose-unique-validator": "^3.1.0",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"rimraf": "^3.0.2",
|
||||
"rxjs": "^7.2.0",
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
import { ArgumentsHost, Catch, ConflictException, ExceptionFilter } from '@nestjs/common';
|
||||
import { MongoError } from 'mongodb';
|
||||
|
||||
@Catch(MongoError)
|
||||
export class MongoExceptionFilter implements ExceptionFilter {
|
||||
catch(exception: MongoError, host: ArgumentsHost) {
|
||||
switch (exception.code) {
|
||||
case 11000:
|
||||
console.log('llave duplicada')
|
||||
// duplicate exception
|
||||
// do whatever you want here, for instance send error to client
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,23 +1,27 @@
|
|||
import { Module } from '@nestjs/common';
|
||||
import { MongooseModule } from '@nestjs/mongoose';
|
||||
import { ClientsModule, Transport } from "@nestjs/microservices";
|
||||
import { ClientsModule, Transport } from '@nestjs/microservices';
|
||||
import { UsersModule } from './users/users.module';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
ClientsModule.register([
|
||||
{
|
||||
name: "SERVICIO_USUARIOS",
|
||||
name: 'SERVICIO_USUARIOS',
|
||||
transport: Transport.TCP,
|
||||
options: {
|
||||
host: "127.0.0.1",
|
||||
port: 3001
|
||||
}
|
||||
}
|
||||
host: '127.0.0.1',
|
||||
port: 3001,
|
||||
},
|
||||
},
|
||||
]),
|
||||
MongooseModule.forRoot(`mongodb+srv://proyecto_4:proyecto_4@proyecto4.yv4fb.mongodb.net/servicio_usuarios?retryWrites=true&w=majority`),
|
||||
UsersModule],
|
||||
MongooseModule.forRoot(
|
||||
`mongodb+srv://proyecto_4:proyecto_4@proyecto4.yv4fb.mongodb.net/servicio_usuarios?retryWrites=true&w=majority`
|
||||
|
||||
),
|
||||
UsersModule,
|
||||
],
|
||||
controllers: [],
|
||||
providers: [],
|
||||
})
|
||||
export class AppModule {}
|
||||
export class AppModule { }
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
import { Injectable } from "@nestjs/common";
|
||||
import { Model } from 'mongoose';
|
||||
import { User, UserDocument } from '../schemas/user.schema';
|
||||
import { InjectModel } from '@nestjs/mongoose';
|
||||
import { ValidationArguments, ValidatorConstraint, ValidatorConstraintInterface } from "class-validator";
|
||||
|
||||
|
||||
@ValidatorConstraint({ name: 'UserExists', async: true })
|
||||
@Injectable()
|
||||
export class UserExistsRule implements ValidatorConstraintInterface {
|
||||
constructor(
|
||||
@InjectModel(User.name) private readonly userModel: Model<UserDocument>,
|
||||
) {}
|
||||
|
||||
async validate(value: string) {
|
||||
try {
|
||||
await this.userModel.find({email: value});
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
defaultMessage(args: ValidationArguments) {
|
||||
return `User doesn't exist`;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
import { NestFactory } from "@nestjs/core";
|
||||
import { Transport } from "@nestjs/microservices";
|
||||
import { AppModule } from "./app.module";
|
||||
import { Logger } from "@nestjs/common";
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { Transport } from '@nestjs/microservices';
|
||||
import { AppModule } from './app.module';
|
||||
import { Logger } from '@nestjs/common';
|
||||
|
||||
const logger = new Logger();
|
||||
|
||||
|
@ -9,10 +9,10 @@ async function bootstrap() {
|
|||
const app = await NestFactory.createMicroservice(AppModule, {
|
||||
transport: Transport.TCP,
|
||||
options: {
|
||||
host: "127.0.0.1",
|
||||
port: 3001
|
||||
}
|
||||
host: '127.0.0.1',
|
||||
port: 3001,
|
||||
},
|
||||
});
|
||||
app.listen().then(() => logger.log("Microservice Usuarios is listening" ));
|
||||
app.listen().then(() => logger.log('Microservice Usuarios is listening'));
|
||||
}
|
||||
bootstrap();
|
||||
bootstrap();
|
||||
|
|
|
@ -1,46 +1,42 @@
|
|||
|
||||
import { Schema, Prop, SchemaFactory } from '@nestjs/mongoose';
|
||||
import { Document } from 'mongoose';
|
||||
|
||||
var uniqueValidator = require('mongoose-unique-validator');
|
||||
import { IsEmail, IsNotEmpty, IsString, Validate } from 'class-validator';
|
||||
|
||||
export type UserDocument = User & Document;
|
||||
|
||||
|
||||
@Schema({ collection: 'users' })
|
||||
@Schema({ collection: 'users'})
|
||||
export class User {
|
||||
@Prop({index: true})
|
||||
dni!: string;
|
||||
|
||||
@Prop()
|
||||
dni: string;
|
||||
@Prop({required: true})
|
||||
name: string;
|
||||
|
||||
@Prop()
|
||||
name: string;
|
||||
@Prop({required: true})
|
||||
last_name: string;
|
||||
|
||||
@Prop()
|
||||
last_name: string;
|
||||
@Prop({required: true, unique: true})
|
||||
email: string;
|
||||
|
||||
@Prop()
|
||||
email: string;
|
||||
@Prop({required: true, unique: true})
|
||||
phone: number;
|
||||
|
||||
@Prop()
|
||||
phone: number;
|
||||
@Prop()
|
||||
password: string;
|
||||
|
||||
@Prop()
|
||||
password: string;
|
||||
@Prop()
|
||||
user_type: string;
|
||||
|
||||
@Prop()
|
||||
user_type: string;
|
||||
@Prop()
|
||||
status: string;
|
||||
|
||||
@Prop()
|
||||
status: string;
|
||||
@Prop()
|
||||
date_entry: Date;
|
||||
|
||||
@Prop()
|
||||
date_entry: Date;
|
||||
|
||||
|
||||
@Prop()
|
||||
community_id?: string;
|
||||
@Prop()
|
||||
community_id?: string;
|
||||
}
|
||||
|
||||
|
||||
|
||||
export const UserSchema = SchemaFactory.createForClass(User);
|
||||
export const UserSchema = SchemaFactory.createForClass(User);
|
||||
UserSchema.plugin(uniqueValidator);
|
|
@ -1,11 +1,12 @@
|
|||
import { Controller } from '@nestjs/common';
|
||||
import { Controller, UseFilters } from '@nestjs/common';
|
||||
import { MessagePattern, Payload } from '@nestjs/microservices';
|
||||
import { User, UserDocument } from '../schemas/user.schema';
|
||||
import { UsersService } from './users.service';
|
||||
import { MongoExceptionFilter } from 'src/MongoExceptionFilter';
|
||||
|
||||
@Controller()
|
||||
export class UsersController {
|
||||
constructor(private readonly userService: UsersService) { }
|
||||
constructor(private readonly userService: UsersService) {}
|
||||
|
||||
@MessagePattern({ cmd: 'createUser' })
|
||||
create(@Payload() user: UserDocument) {
|
||||
|
@ -13,6 +14,7 @@ export class UsersController {
|
|||
}
|
||||
|
||||
@MessagePattern({ cmd: 'createAdminSystem' })
|
||||
@UseFilters(MongoExceptionFilter)
|
||||
createUserAdmin(@Payload() user: UserDocument) {
|
||||
return this.userService.create(user);
|
||||
}
|
||||
|
@ -22,6 +24,10 @@ export class UsersController {
|
|||
return this.userService.create(user);
|
||||
}
|
||||
|
||||
@MessagePattern({ cmd: 'createAdminCommunity' })
|
||||
createAdminCommunity(@Payload() user: UserDocument) {
|
||||
return this.userService.createAdminCommunity(user);
|
||||
}
|
||||
|
||||
@MessagePattern({ cmd: 'findAllUsers' })
|
||||
findAll() {
|
||||
|
@ -39,7 +45,6 @@ export class UsersController {
|
|||
let pcommunity_id = community_id['community_id'];
|
||||
return this.userService.findGuardsCommunity(pcommunity_id);
|
||||
}
|
||||
|
||||
|
||||
@MessagePattern({ cmd: 'findTenantsCommunity' })
|
||||
findTenantsCommunity(@Payload() community_id: string) {
|
||||
|
@ -93,15 +98,19 @@ export class UsersController {
|
|||
//buscar usuario de una comunidad
|
||||
@MessagePattern({ cmd: 'findOneCommunityUser' })
|
||||
findCommunityUser(@Payload() user: any) {
|
||||
return this.userService.findCommunityUser(user["community_id"], user["user_type"]);
|
||||
return this.userService.findCommunityUser(
|
||||
user['community_id'],
|
||||
user['user_type'],
|
||||
);
|
||||
}
|
||||
|
||||
@MessagePattern({ cmd: 'deleteAdminSystem' })
|
||||
deleteAdminSystem(@Payload() user: any) {
|
||||
console.log("entró")
|
||||
console.log('entró');
|
||||
|
||||
return this.userService.deleteAdminSystem(user["id"]);
|
||||
return this.userService.deleteAdminSystem(user['id']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -4,23 +4,33 @@ import { MongooseModule } from '@nestjs/mongoose';
|
|||
|
||||
import { UsersController } from './users.controller';
|
||||
import { User, UserSchema } from '../schemas/user.schema';
|
||||
import { ClientsModule, Transport } from "@nestjs/microservices";
|
||||
import { ClientsModule, Transport } from '@nestjs/microservices';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
ClientsModule.register([
|
||||
{
|
||||
name: "SERVICIO_NOTIFICACIONES",
|
||||
name: 'SERVICIO_NOTIFICACIONES',
|
||||
transport: Transport.TCP,
|
||||
options: {
|
||||
host: '127.0.0.1',
|
||||
port: 3009,
|
||||
},
|
||||
},
|
||||
]),
|
||||
ClientsModule.register([
|
||||
{
|
||||
name: "SERVICIO_COMUNIDADES",
|
||||
transport: Transport.TCP,
|
||||
options: {
|
||||
host: "127.0.0.1",
|
||||
port: 3009
|
||||
port: 3002
|
||||
}
|
||||
}
|
||||
]),
|
||||
MongooseModule.forFeature([{ name: User.name, schema: UserSchema }]),
|
||||
],
|
||||
controllers: [UsersController],
|
||||
providers: [UsersService]
|
||||
providers: [UsersService],
|
||||
})
|
||||
export class UsersModule {}
|
||||
|
|
|
@ -2,18 +2,18 @@ import { Injectable, Inject } from '@nestjs/common';
|
|||
import { Model } from 'mongoose';
|
||||
import { User, UserDocument } from '../schemas/user.schema';
|
||||
import { InjectModel } from '@nestjs/mongoose';
|
||||
import { Md5 } from "md5-typescript";
|
||||
import { Md5 } from 'md5-typescript';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { lastValueFrom } from 'rxjs';
|
||||
|
||||
import { RpcException, ClientProxy } from '@nestjs/microservices';
|
||||
|
||||
|
||||
|
||||
@Injectable()
|
||||
export class UsersService {
|
||||
constructor(
|
||||
@InjectModel(User.name) private readonly userModel: Model<UserDocument>,
|
||||
@Inject('SERVICIO_NOTIFICACIONES') private readonly clientNotificationtApp: ClientProxy,
|
||||
@Inject('SERVICIO_COMUNIDADES') private readonly clientCommunityApp: ClientProxy,
|
||||
|
||||
) { }
|
||||
private publicKey: string;
|
||||
|
@ -23,11 +23,44 @@ export class UsersService {
|
|||
return this.userModel.create(user);
|
||||
}
|
||||
|
||||
|
||||
async createAdminCommunity(user: UserDocument) {
|
||||
let password = user.password;
|
||||
let passwordEncriptada = Md5.init(user.password);
|
||||
user.password = passwordEncriptada;
|
||||
|
||||
this.userModel.create(user)
|
||||
|
||||
|
||||
let community = await this.findCommunity(user.community_id);
|
||||
user.community_id = community['name'];
|
||||
|
||||
const pattern = { cmd: 'emailCreateUserAdminCommunity' };
|
||||
const payload = { email: user['email'], password: password, name: user['name'],
|
||||
date_entry: user['date_entry'], community_name: community['name'] };
|
||||
return this.clientNotificationtApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(
|
||||
map((message: string) => ({ message })),
|
||||
);
|
||||
}
|
||||
|
||||
async findCommunity(community_id: string) {
|
||||
const pattern = { cmd: 'findOneCommunity' }
|
||||
const payload = { _id: community_id }
|
||||
|
||||
let callback = await this.clientCommunityApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(
|
||||
map((response: string) => ({ response }))
|
||||
)
|
||||
const finalValue = await lastValueFrom(callback);
|
||||
return finalValue['response'];
|
||||
|
||||
}
|
||||
|
||||
async findAll(): Promise<User[]> {
|
||||
return this.userModel
|
||||
.find()
|
||||
.setOptions({ sanitizeFilter: true })
|
||||
.exec();
|
||||
return this.userModel.find().setOptions({ sanitizeFilter: true }).exec();
|
||||
}
|
||||
async findOne(id: string): Promise<User> {
|
||||
return this.userModel.findOne({ _id: id }).exec();
|
||||
|
@ -56,13 +89,11 @@ export class UsersService {
|
|||
repo.find({ email: email }).exec((err, res) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
let passwordEncriptada = Md5.init(password);
|
||||
if (res[0].password == passwordEncriptada) {
|
||||
resolve(res[0]);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
resolve(null);
|
||||
}
|
||||
}
|
||||
|
@ -77,7 +108,6 @@ export class UsersService {
|
|||
return this.userModel.find({ user_type: 1 }).exec();
|
||||
}
|
||||
|
||||
|
||||
//find admin del sistema
|
||||
async findGuardsCommunity(pcommunity_id: string): Promise<User[]> {
|
||||
return this.userModel.find({ user_type: 4 }).exec();
|
||||
|
@ -102,7 +132,7 @@ export class UsersService {
|
|||
async testSendMail(user: UserDocument) {
|
||||
let passwordEncriptada = Md5.init(user.password);
|
||||
user.password = passwordEncriptada;
|
||||
this.userModel.create(user)
|
||||
this.userModel.create(user);
|
||||
/*.then(() => {
|
||||
|
||||
} );*/
|
||||
|
@ -111,17 +141,38 @@ export class UsersService {
|
|||
const payload = { email: user['email'], name: user['name'] };
|
||||
return this.clientNotificationtApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(
|
||||
map((message: string) => ({ message })),
|
||||
);
|
||||
.pipe(map((message: string) => ({ message })));
|
||||
}
|
||||
|
||||
async findCommunityUser(community_id: string, user_type: number): Promise<User> {
|
||||
return this.userModel.findOne({ community_id: community_id, user_type: user_type }).exec();
|
||||
async findCommunityUser(
|
||||
community_id: string,
|
||||
user_type: number,
|
||||
): Promise<User> {
|
||||
return this.userModel
|
||||
.findOne({ community_id: community_id, user_type: user_type })
|
||||
.exec();
|
||||
}
|
||||
|
||||
async deleteAdminSystem(id: string) {
|
||||
return this.userModel.deleteOne({_id: id}).exec();
|
||||
return this.userModel.deleteOne({ _id: id }).exec();
|
||||
}
|
||||
|
||||
async validateEmail(email: string) {
|
||||
let repo1 = this.userModel;
|
||||
return new Promise<User>((resolve, reject) => {
|
||||
let repo = repo1;
|
||||
|
||||
repo.find({ email: email }).exec((err, res) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else {
|
||||
if (res.length > 0) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -50,303 +50,394 @@ import './assets/demo/Demos.scss';
|
|||
import './assets/layout/layout.scss';
|
||||
import './App.scss';
|
||||
import LogIn from './components/LogIn';
|
||||
import {PrimeIcons} from 'primereact/api';
|
||||
import { PrimeIcons } from 'primereact/api';
|
||||
|
||||
const App = () => {
|
||||
const [layoutMode, setLayoutMode] = useState('static');
|
||||
const [layoutColorMode, setLayoutColorMode] = useState('light')
|
||||
const [inputStyle, setInputStyle] = useState('outlined');
|
||||
const [ripple, setRipple] = useState(true);
|
||||
const [staticMenuInactive, setStaticMenuInactive] = useState(false);
|
||||
const [overlayMenuActive, setOverlayMenuActive] = useState(false);
|
||||
const [mobileMenuActive, setMobileMenuActive] = useState(false);
|
||||
const [mobileTopbarMenuActive, setMobileTopbarMenuActive] = useState(false);
|
||||
const copyTooltipRef = useRef();
|
||||
const location = useLocation();
|
||||
const [layoutMode, setLayoutMode] = useState('static');
|
||||
const [layoutColorMode, setLayoutColorMode] = useState('light');
|
||||
const [inputStyle, setInputStyle] = useState('outlined');
|
||||
const [ripple, setRipple] = useState(true);
|
||||
const [staticMenuInactive, setStaticMenuInactive] = useState(false);
|
||||
const [overlayMenuActive, setOverlayMenuActive] = useState(false);
|
||||
const [mobileMenuActive, setMobileMenuActive] = useState(false);
|
||||
const [mobileTopbarMenuActive, setMobileTopbarMenuActive] = useState(false);
|
||||
const copyTooltipRef = useRef();
|
||||
const location = useLocation();
|
||||
|
||||
PrimeReact.ripple = true;
|
||||
PrimeReact.ripple = true;
|
||||
|
||||
let menuClick = false;
|
||||
let mobileTopbarMenuClick = false;
|
||||
let menuClick = false;
|
||||
let mobileTopbarMenuClick = false;
|
||||
|
||||
useEffect(() => {
|
||||
if (mobileMenuActive) {
|
||||
addClass(document.body, "body-overflow-hidden");
|
||||
} else {
|
||||
removeClass(document.body, "body-overflow-hidden");
|
||||
}
|
||||
}, [mobileMenuActive]);
|
||||
useEffect(() => {
|
||||
if (mobileMenuActive) {
|
||||
addClass(document.body, 'body-overflow-hidden');
|
||||
} else {
|
||||
removeClass(document.body, 'body-overflow-hidden');
|
||||
}
|
||||
}, [mobileMenuActive]);
|
||||
|
||||
useEffect(() => {
|
||||
copyTooltipRef && copyTooltipRef.current && copyTooltipRef.current.updateTargetEvents();
|
||||
}, [location]);
|
||||
useEffect(() => {
|
||||
copyTooltipRef &&
|
||||
copyTooltipRef.current &&
|
||||
copyTooltipRef.current.updateTargetEvents();
|
||||
}, [location]);
|
||||
|
||||
const onInputStyleChange = (inputStyle) => {
|
||||
setInputStyle(inputStyle);
|
||||
const onInputStyleChange = (inputStyle) => {
|
||||
setInputStyle(inputStyle);
|
||||
};
|
||||
|
||||
const onRipple = (e) => {
|
||||
PrimeReact.ripple = e.value;
|
||||
setRipple(e.value);
|
||||
};
|
||||
|
||||
const onLayoutModeChange = (mode) => {
|
||||
setLayoutMode(mode);
|
||||
};
|
||||
|
||||
const onColorModeChange = (mode) => {
|
||||
setLayoutColorMode(mode);
|
||||
};
|
||||
|
||||
const onWrapperClick = (event) => {
|
||||
if (!menuClick) {
|
||||
setOverlayMenuActive(false);
|
||||
setMobileMenuActive(false);
|
||||
}
|
||||
|
||||
const onRipple = (e) => {
|
||||
PrimeReact.ripple = e.value;
|
||||
setRipple(e.value)
|
||||
if (!mobileTopbarMenuClick) {
|
||||
setMobileTopbarMenuActive(false);
|
||||
}
|
||||
|
||||
const onLayoutModeChange = (mode) => {
|
||||
setLayoutMode(mode)
|
||||
}
|
||||
mobileTopbarMenuClick = false;
|
||||
menuClick = false;
|
||||
};
|
||||
|
||||
const onColorModeChange = (mode) => {
|
||||
setLayoutColorMode(mode)
|
||||
}
|
||||
const onToggleMenuClick = (event) => {
|
||||
menuClick = true;
|
||||
|
||||
const onWrapperClick = (event) => {
|
||||
if (!menuClick) {
|
||||
setOverlayMenuActive(false);
|
||||
setMobileMenuActive(false);
|
||||
if (isDesktop()) {
|
||||
if (layoutMode === 'overlay') {
|
||||
if (mobileMenuActive === true) {
|
||||
setOverlayMenuActive(true);
|
||||
}
|
||||
|
||||
if (!mobileTopbarMenuClick) {
|
||||
setMobileTopbarMenuActive(false);
|
||||
}
|
||||
|
||||
mobileTopbarMenuClick = false;
|
||||
menuClick = false;
|
||||
setOverlayMenuActive((prevState) => !prevState);
|
||||
setMobileMenuActive(false);
|
||||
} else if (layoutMode === 'static') {
|
||||
setStaticMenuInactive((prevState) => !prevState);
|
||||
}
|
||||
} else {
|
||||
setMobileMenuActive((prevState) => !prevState);
|
||||
}
|
||||
|
||||
const onToggleMenuClick = (event) => {
|
||||
menuClick = true;
|
||||
event.preventDefault();
|
||||
};
|
||||
|
||||
if (isDesktop()) {
|
||||
if (layoutMode === 'overlay') {
|
||||
if (mobileMenuActive === true) {
|
||||
setOverlayMenuActive(true);
|
||||
}
|
||||
const onSidebarClick = () => {
|
||||
menuClick = true;
|
||||
};
|
||||
|
||||
setOverlayMenuActive((prevState) => !prevState);
|
||||
setMobileMenuActive(false);
|
||||
}
|
||||
else if (layoutMode === 'static') {
|
||||
setStaticMenuInactive((prevState) => !prevState);
|
||||
}
|
||||
}
|
||||
else {
|
||||
setMobileMenuActive((prevState) => !prevState);
|
||||
}
|
||||
const onMobileTopbarMenuClick = (event) => {
|
||||
mobileTopbarMenuClick = true;
|
||||
|
||||
event.preventDefault();
|
||||
setMobileTopbarMenuActive((prevState) => !prevState);
|
||||
event.preventDefault();
|
||||
};
|
||||
|
||||
const onMobileSubTopbarMenuClick = (event) => {
|
||||
mobileTopbarMenuClick = true;
|
||||
|
||||
event.preventDefault();
|
||||
};
|
||||
|
||||
const onMenuItemClick = (event) => {
|
||||
if (!event.item.items) {
|
||||
setOverlayMenuActive(false);
|
||||
setMobileMenuActive(false);
|
||||
}
|
||||
};
|
||||
const isDesktop = () => {
|
||||
return window.innerWidth >= 992;
|
||||
};
|
||||
|
||||
const onSidebarClick = () => {
|
||||
menuClick = true;
|
||||
}
|
||||
|
||||
const onMobileTopbarMenuClick = (event) => {
|
||||
mobileTopbarMenuClick = true;
|
||||
|
||||
setMobileTopbarMenuActive((prevState) => !prevState);
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
const onMobileSubTopbarMenuClick = (event) => {
|
||||
mobileTopbarMenuClick = true;
|
||||
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
const onMenuItemClick = (event) => {
|
||||
if (!event.item.items) {
|
||||
setOverlayMenuActive(false);
|
||||
setMobileMenuActive(false);
|
||||
}
|
||||
}
|
||||
const isDesktop = () => {
|
||||
return window.innerWidth >= 992;
|
||||
}
|
||||
|
||||
const menu = [
|
||||
const menu = [
|
||||
{
|
||||
label: 'Home',
|
||||
items: [
|
||||
{ label: 'Dashboard', icon: 'pi pi-fw pi-home', to: '/' },
|
||||
{
|
||||
label: 'Home',
|
||||
items: [
|
||||
{label: 'Dashboard', icon: 'pi pi-fw pi-home', to: '/'},
|
||||
{label: 'Administradores del sistema', icon: PrimeIcons.USERS, to: '/administradoresSistema'},
|
||||
{label: 'Administradores de comunidad', icon: PrimeIcons.USERS, to: '/administradoresComunidad'},
|
||||
{label: 'Guardas de seguridad', icon: PrimeIcons.LOCK, to: '/guardasSeguridad'},
|
||||
{label: 'Comunidadades', icon: PrimeIcons.BUILDING, to: '/comunidadesViviendas'},
|
||||
{label: 'Inquilinos', icon: PrimeIcons.USER, to: '/inquilinos'},
|
||||
{label: 'Log in', icon: 'pi pi-fw pi-id-card', to: '/logIn'}
|
||||
]
|
||||
label: 'Administradores del sistema',
|
||||
icon: PrimeIcons.USERS,
|
||||
to: '/administradoresSistema',
|
||||
},
|
||||
{
|
||||
label: 'UI Components', icon: 'pi pi-fw pi-sitemap',
|
||||
items: [
|
||||
{ label: 'Form Layout', icon: 'pi pi-fw pi-id-card', to: '/formlayout' },
|
||||
{ label: 'Input', icon: 'pi pi-fw pi-check-square', to: '/input' },
|
||||
{ label: "Float Label", icon: "pi pi-fw pi-bookmark", to: "/floatlabel" },
|
||||
{ label: "Invalid State", icon: "pi pi-fw pi-exclamation-circle", to: "invalidstate" },
|
||||
{ label: 'Button', icon: 'pi pi-fw pi-mobile', to: '/button' },
|
||||
{ label: 'Table', icon: 'pi pi-fw pi-table', to: '/table' },
|
||||
{ label: 'List', icon: 'pi pi-fw pi-list', to: '/list' },
|
||||
{ label: 'Tree', icon: 'pi pi-fw pi-share-alt', to: '/tree' },
|
||||
{ label: 'Panel', icon: 'pi pi-fw pi-tablet', to: '/panel' },
|
||||
{ label: 'Overlay', icon: 'pi pi-fw pi-clone', to: '/overlay' },
|
||||
{ label: "Media", icon: "pi pi-fw pi-image", to: "/media" },
|
||||
{ label: 'Menu', icon: 'pi pi-fw pi-bars', to: '/menu' },
|
||||
{ label: 'Message', icon: 'pi pi-fw pi-comment', to: '/messages' },
|
||||
{ label: 'File', icon: 'pi pi-fw pi-file', to: '/file' },
|
||||
{ label: 'Chart', icon: 'pi pi-fw pi-chart-bar', to: '/chart' },
|
||||
{ label: 'Misc', icon: 'pi pi-fw pi-circle-off', to: '/misc' },
|
||||
]
|
||||
label: 'Administradores de comunidad',
|
||||
icon: PrimeIcons.USERS,
|
||||
to: '/administradoresComunidad',
|
||||
},
|
||||
{
|
||||
label: 'UI Blocks',
|
||||
items: [
|
||||
{ label: 'Free Blocks', icon: 'pi pi-fw pi-eye', to: '/blocks', badge: "NEW" },
|
||||
{ label: 'All Blocks', icon: 'pi pi-fw pi-globe', url: 'https://www.primefaces.org/primeblocks-react' }
|
||||
]
|
||||
label: 'Guardas de seguridad',
|
||||
icon: PrimeIcons.LOCK,
|
||||
to: '/guardasSeguridad',
|
||||
},
|
||||
{
|
||||
label: 'Icons',
|
||||
items: [
|
||||
{ label: 'PrimeIcons', icon: 'pi pi-fw pi-prime', to: '/icons' }
|
||||
]
|
||||
label: 'Comunidadades',
|
||||
icon: PrimeIcons.BUILDING,
|
||||
to: '/comunidadesViviendas',
|
||||
},
|
||||
{ label: 'Inquilinos', icon: PrimeIcons.USER, to: '/inquilinos' },
|
||||
{ label: 'Log in', icon: 'pi pi-fw pi-id-card', to: '/logIn' },
|
||||
],
|
||||
},
|
||||
{
|
||||
label: 'UI Components',
|
||||
icon: 'pi pi-fw pi-sitemap',
|
||||
items: [
|
||||
{
|
||||
label: 'Form Layout',
|
||||
icon: 'pi pi-fw pi-id-card',
|
||||
to: '/formlayout',
|
||||
},
|
||||
{ label: 'Input', icon: 'pi pi-fw pi-check-square', to: '/input' },
|
||||
{
|
||||
label: 'Float Label',
|
||||
icon: 'pi pi-fw pi-bookmark',
|
||||
to: '/floatlabel',
|
||||
},
|
||||
{
|
||||
label: 'Pages', icon: 'pi pi-fw pi-clone',
|
||||
items: [
|
||||
{ label: 'Crud', icon: 'pi pi-fw pi-user-edit', to: '/crud' },
|
||||
{ label: 'Timeline', icon: 'pi pi-fw pi-calendar', to: '/timeline' },
|
||||
{ label: 'Empty', icon: 'pi pi-fw pi-circle-off', to: '/empty' }
|
||||
]
|
||||
label: 'Invalid State',
|
||||
icon: 'pi pi-fw pi-exclamation-circle',
|
||||
to: 'invalidstate',
|
||||
},
|
||||
{ label: 'Button', icon: 'pi pi-fw pi-mobile', to: '/button' },
|
||||
{ label: 'Table', icon: 'pi pi-fw pi-table', to: '/table' },
|
||||
{ label: 'List', icon: 'pi pi-fw pi-list', to: '/list' },
|
||||
{ label: 'Tree', icon: 'pi pi-fw pi-share-alt', to: '/tree' },
|
||||
{ label: 'Panel', icon: 'pi pi-fw pi-tablet', to: '/panel' },
|
||||
{ label: 'Overlay', icon: 'pi pi-fw pi-clone', to: '/overlay' },
|
||||
{ label: 'Media', icon: 'pi pi-fw pi-image', to: '/media' },
|
||||
{ label: 'Menu', icon: 'pi pi-fw pi-bars', to: '/menu' },
|
||||
{ label: 'Message', icon: 'pi pi-fw pi-comment', to: '/messages' },
|
||||
{ label: 'File', icon: 'pi pi-fw pi-file', to: '/file' },
|
||||
{ label: 'Chart', icon: 'pi pi-fw pi-chart-bar', to: '/chart' },
|
||||
{ label: 'Misc', icon: 'pi pi-fw pi-circle-off', to: '/misc' },
|
||||
],
|
||||
},
|
||||
{
|
||||
label: 'UI Blocks',
|
||||
items: [
|
||||
{
|
||||
label: 'Free Blocks',
|
||||
icon: 'pi pi-fw pi-eye',
|
||||
to: '/blocks',
|
||||
badge: 'NEW',
|
||||
},
|
||||
{
|
||||
label: 'Menu Hierarchy', icon: 'pi pi-fw pi-search',
|
||||
items: [
|
||||
{
|
||||
label: 'Submenu 1', icon: 'pi pi-fw pi-bookmark',
|
||||
items: [
|
||||
{
|
||||
label: 'Submenu 1.1', icon: 'pi pi-fw pi-bookmark',
|
||||
items: [
|
||||
{ label: 'Submenu 1.1.1', icon: 'pi pi-fw pi-bookmark' },
|
||||
{ label: 'Submenu 1.1.2', icon: 'pi pi-fw pi-bookmark' },
|
||||
{ label: 'Submenu 1.1.3', icon: 'pi pi-fw pi-bookmark' },
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Submenu 1.2', icon: 'pi pi-fw pi-bookmark',
|
||||
items: [
|
||||
{ label: 'Submenu 1.2.1', icon: 'pi pi-fw pi-bookmark' },
|
||||
{ label: 'Submenu 1.2.2', icon: 'pi pi-fw pi-bookmark' }
|
||||
]
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Submenu 2', icon: 'pi pi-fw pi-bookmark',
|
||||
items: [
|
||||
{
|
||||
label: 'Submenu 2.1', icon: 'pi pi-fw pi-bookmark',
|
||||
items: [
|
||||
{ label: 'Submenu 2.1.1', icon: 'pi pi-fw pi-bookmark' },
|
||||
{ label: 'Submenu 2.1.2', icon: 'pi pi-fw pi-bookmark' },
|
||||
{ label: 'Submenu 2.1.3', icon: 'pi pi-fw pi-bookmark' },
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Submenu 2.2', icon: 'pi pi-fw pi-bookmark',
|
||||
items: [
|
||||
{ label: 'Submenu 2.2.1', icon: 'pi pi-fw pi-bookmark' },
|
||||
{ label: 'Submenu 2.2.2', icon: 'pi pi-fw pi-bookmark' }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
label: 'All Blocks',
|
||||
icon: 'pi pi-fw pi-globe',
|
||||
url: 'https://www.primefaces.org/primeblocks-react',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: 'Icons',
|
||||
items: [{ label: 'PrimeIcons', icon: 'pi pi-fw pi-prime', to: '/icons' }],
|
||||
},
|
||||
{
|
||||
label: 'Pages',
|
||||
icon: 'pi pi-fw pi-clone',
|
||||
items: [
|
||||
{ label: 'Crud', icon: 'pi pi-fw pi-user-edit', to: '/crud' },
|
||||
{ label: 'Timeline', icon: 'pi pi-fw pi-calendar', to: '/timeline' },
|
||||
{ label: 'Empty', icon: 'pi pi-fw pi-circle-off', to: '/empty' },
|
||||
],
|
||||
},
|
||||
{
|
||||
label: 'Menu Hierarchy',
|
||||
icon: 'pi pi-fw pi-search',
|
||||
items: [
|
||||
{
|
||||
label: 'Submenu 1',
|
||||
icon: 'pi pi-fw pi-bookmark',
|
||||
items: [
|
||||
{
|
||||
label: 'Submenu 1.1',
|
||||
icon: 'pi pi-fw pi-bookmark',
|
||||
items: [
|
||||
{ label: 'Submenu 1.1.1', icon: 'pi pi-fw pi-bookmark' },
|
||||
{ label: 'Submenu 1.1.2', icon: 'pi pi-fw pi-bookmark' },
|
||||
{ label: 'Submenu 1.1.3', icon: 'pi pi-fw pi-bookmark' },
|
||||
],
|
||||
},
|
||||
{
|
||||
label: 'Submenu 1.2',
|
||||
icon: 'pi pi-fw pi-bookmark',
|
||||
items: [
|
||||
{ label: 'Submenu 1.2.1', icon: 'pi pi-fw pi-bookmark' },
|
||||
{ label: 'Submenu 1.2.2', icon: 'pi pi-fw pi-bookmark' },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: 'Submenu 2',
|
||||
icon: 'pi pi-fw pi-bookmark',
|
||||
items: [
|
||||
{
|
||||
label: 'Submenu 2.1',
|
||||
icon: 'pi pi-fw pi-bookmark',
|
||||
items: [
|
||||
{ label: 'Submenu 2.1.1', icon: 'pi pi-fw pi-bookmark' },
|
||||
{ label: 'Submenu 2.1.2', icon: 'pi pi-fw pi-bookmark' },
|
||||
{ label: 'Submenu 2.1.3', icon: 'pi pi-fw pi-bookmark' },
|
||||
],
|
||||
},
|
||||
{
|
||||
label: 'Submenu 2.2',
|
||||
icon: 'pi pi-fw pi-bookmark',
|
||||
items: [
|
||||
{ label: 'Submenu 2.2.1', icon: 'pi pi-fw pi-bookmark' },
|
||||
{ label: 'Submenu 2.2.2', icon: 'pi pi-fw pi-bookmark' },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
const addClass = (element, className) => {
|
||||
if (element.classList)
|
||||
element.classList.add(className);
|
||||
else
|
||||
element.className += ' ' + className;
|
||||
}
|
||||
const addClass = (element, className) => {
|
||||
if (element.classList) element.classList.add(className);
|
||||
else element.className += ' ' + className;
|
||||
};
|
||||
|
||||
const removeClass = (element, className) => {
|
||||
if (element.classList)
|
||||
element.classList.remove(className);
|
||||
else
|
||||
element.className = element.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
|
||||
}
|
||||
const removeClass = (element, className) => {
|
||||
if (element.classList) element.classList.remove(className);
|
||||
else
|
||||
element.className = element.className.replace(
|
||||
new RegExp(
|
||||
'(^|\\b)' + className.split(' ').join('|') + '(\\b|$)',
|
||||
'gi',
|
||||
),
|
||||
' ',
|
||||
);
|
||||
};
|
||||
|
||||
const wrapperClass = classNames('layout-wrapper', {
|
||||
'layout-overlay': layoutMode === 'overlay',
|
||||
'layout-static': layoutMode === 'static',
|
||||
'layout-static-sidebar-inactive': staticMenuInactive && layoutMode === 'static',
|
||||
'layout-overlay-sidebar-active': overlayMenuActive && layoutMode === 'overlay',
|
||||
'layout-mobile-sidebar-active': mobileMenuActive,
|
||||
'p-input-filled': inputStyle === 'filled',
|
||||
'p-ripple-disabled': ripple === false,
|
||||
'layout-theme-light': layoutColorMode === 'light'
|
||||
});
|
||||
const wrapperClass = classNames('layout-wrapper', {
|
||||
'layout-overlay': layoutMode === 'overlay',
|
||||
'layout-static': layoutMode === 'static',
|
||||
'layout-static-sidebar-inactive':
|
||||
staticMenuInactive && layoutMode === 'static',
|
||||
'layout-overlay-sidebar-active':
|
||||
overlayMenuActive && layoutMode === 'overlay',
|
||||
'layout-mobile-sidebar-active': mobileMenuActive,
|
||||
'p-input-filled': inputStyle === 'filled',
|
||||
'p-ripple-disabled': ripple === false,
|
||||
'layout-theme-light': layoutColorMode === 'light',
|
||||
});
|
||||
|
||||
return (
|
||||
<div className={wrapperClass} onClick={onWrapperClick}>
|
||||
<Tooltip ref={copyTooltipRef} target=".block-action-copy" position="bottom" content="Copied to clipboard" event="focus" />
|
||||
return (
|
||||
<div className={wrapperClass} onClick={onWrapperClick}>
|
||||
<Tooltip
|
||||
ref={copyTooltipRef}
|
||||
target=".block-action-copy"
|
||||
position="bottom"
|
||||
content="Copied to clipboard"
|
||||
event="focus"
|
||||
/>
|
||||
|
||||
<AppTopbar onToggleMenuClick={onToggleMenuClick} layoutColorMode={layoutColorMode}
|
||||
mobileTopbarMenuActive={mobileTopbarMenuActive} onMobileTopbarMenuClick={onMobileTopbarMenuClick} onMobileSubTopbarMenuClick={onMobileSubTopbarMenuClick} />
|
||||
|
||||
<div className="layout-sidebar" onClick={onSidebarClick}>
|
||||
<AppMenu model={menu} onMenuItemClick={onMenuItemClick} layoutColorMode={layoutColorMode} />
|
||||
</div>
|
||||
|
||||
<div className="layout-main-container">
|
||||
<div className="layout-main">
|
||||
<Route path="/" exact render={() => <Dashboard colorMode={layoutColorMode} location={location} />} />
|
||||
<Route path="/formlayout" component={FormLayoutDemo} />
|
||||
<Route path="/input" component={InputDemo} />
|
||||
<Route path="/floatlabel" component={FloatLabelDemo} />
|
||||
<Route path="/invalidstate" component={InvalidStateDemo} />
|
||||
<Route path="/button" component={ButtonDemo} />
|
||||
<Route path="/table" component={TableDemo} />
|
||||
<Route path="/list" component={ListDemo} />
|
||||
<Route path="/tree" component={TreeDemo} />
|
||||
<Route path="/panel" component={PanelDemo} />
|
||||
<Route path="/overlay" component={OverlayDemo} />
|
||||
<Route path="/media" component={MediaDemo} />
|
||||
<Route path="/menu" component={MenuDemo} />
|
||||
<Route path="/messages" component={MessagesDemo} />
|
||||
<Route path="/blocks" component={BlocksDemo} />
|
||||
<Route path="/icons" component={IconsDemo} />
|
||||
<Route path="/file" component={FileDemo} />
|
||||
<Route path="/chart" render={() => <ChartDemo colorMode={layoutColorMode} location={location} />} />
|
||||
<Route path="/misc" component={MiscDemo} />
|
||||
<Route path="/timeline" component={TimelineDemo} />
|
||||
<Route path="/crud" component={Crud} />
|
||||
<Route path="/empty" component={EmptyPage} />
|
||||
<Route path="/documentation" component={Documentation} />
|
||||
<Route path="/administradoresSistema" component={AdministradoresSistema} />
|
||||
<Route path="/administradoresComunidad" component={AdministradoresComunidad} />
|
||||
<Route path="/guardasSeguridad" component={GuardasSeguridad} />
|
||||
<Route path="/comunidadesViviendas" component={Communities} />
|
||||
<Route path="/inquilinos" component={Inquilinos} />
|
||||
<Route path="/logIn" component={LogIn} />
|
||||
</div>
|
||||
|
||||
<AppFooter layoutColorMode={layoutColorMode} />
|
||||
</div>
|
||||
|
||||
<AppConfig rippleEffect={ripple} onRippleEffect={onRipple} inputStyle={inputStyle} onInputStyleChange={onInputStyleChange}
|
||||
layoutMode={layoutMode} onLayoutModeChange={onLayoutModeChange} layoutColorMode={layoutColorMode} onColorModeChange={onColorModeChange} />
|
||||
|
||||
<CSSTransition classNames="layout-mask" timeout={{ enter: 200, exit: 200 }} in={mobileMenuActive} unmountOnExit>
|
||||
<div className="layout-mask p-component-overlay"></div>
|
||||
</CSSTransition>
|
||||
<AppTopbar
|
||||
onToggleMenuClick={onToggleMenuClick}
|
||||
layoutColorMode={layoutColorMode}
|
||||
mobileTopbarMenuActive={mobileTopbarMenuActive}
|
||||
onMobileTopbarMenuClick={onMobileTopbarMenuClick}
|
||||
onMobileSubTopbarMenuClick={onMobileSubTopbarMenuClick}
|
||||
/>
|
||||
|
||||
<div className="layout-sidebar" onClick={onSidebarClick}>
|
||||
<AppMenu
|
||||
model={menu}
|
||||
onMenuItemClick={onMenuItemClick}
|
||||
layoutColorMode={layoutColorMode}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="layout-main-container">
|
||||
<div className="layout-main">
|
||||
<Route
|
||||
path="/"
|
||||
exact
|
||||
render={() => (
|
||||
<Dashboard colorMode={layoutColorMode} location={location} />
|
||||
)}
|
||||
/>
|
||||
<Route path="/formlayout" component={FormLayoutDemo} />
|
||||
<Route path="/input" component={InputDemo} />
|
||||
<Route path="/floatlabel" component={FloatLabelDemo} />
|
||||
<Route path="/invalidstate" component={InvalidStateDemo} />
|
||||
<Route path="/button" component={ButtonDemo} />
|
||||
<Route path="/table" component={TableDemo} />
|
||||
<Route path="/list" component={ListDemo} />
|
||||
<Route path="/tree" component={TreeDemo} />
|
||||
<Route path="/panel" component={PanelDemo} />
|
||||
<Route path="/overlay" component={OverlayDemo} />
|
||||
<Route path="/media" component={MediaDemo} />
|
||||
<Route path="/menu" component={MenuDemo} />
|
||||
<Route path="/messages" component={MessagesDemo} />
|
||||
<Route path="/blocks" component={BlocksDemo} />
|
||||
<Route path="/icons" component={IconsDemo} />
|
||||
<Route path="/file" component={FileDemo} />
|
||||
<Route
|
||||
path="/chart"
|
||||
render={() => (
|
||||
<ChartDemo colorMode={layoutColorMode} location={location} />
|
||||
)}
|
||||
/>
|
||||
<Route path="/misc" component={MiscDemo} />
|
||||
<Route path="/timeline" component={TimelineDemo} />
|
||||
<Route path="/crud" component={Crud} />
|
||||
<Route path="/empty" component={EmptyPage} />
|
||||
<Route path="/documentation" component={Documentation} />
|
||||
<Route
|
||||
path="/administradoresSistema"
|
||||
component={AdministradoresSistema}
|
||||
/>
|
||||
<Route
|
||||
path="/administradoresComunidad"
|
||||
component={AdministradoresComunidad}
|
||||
/>
|
||||
<Route path="/guardasSeguridad" component={GuardasSeguridad} />
|
||||
<Route path="/comunidadesViviendas" component={Communities} />
|
||||
<Route path="/inquilinos" component={Inquilinos} />
|
||||
<Route path="/logIn" component={LogIn} />
|
||||
</div>
|
||||
);
|
||||
|
||||
}
|
||||
<AppFooter layoutColorMode={layoutColorMode} />
|
||||
</div>
|
||||
|
||||
<AppConfig
|
||||
rippleEffect={ripple}
|
||||
onRippleEffect={onRipple}
|
||||
inputStyle={inputStyle}
|
||||
onInputStyleChange={onInputStyleChange}
|
||||
layoutMode={layoutMode}
|
||||
onLayoutModeChange={onLayoutModeChange}
|
||||
layoutColorMode={layoutColorMode}
|
||||
onColorModeChange={onColorModeChange}
|
||||
/>
|
||||
|
||||
<CSSTransition
|
||||
classNames="layout-mask"
|
||||
timeout={{ enter: 200, exit: 200 }}
|
||||
in={mobileMenuActive}
|
||||
unmountOnExit
|
||||
>
|
||||
<div className="layout-mask p-component-overlay"></div>
|
||||
</CSSTransition>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default App;
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
|
|
@ -3,6 +3,6 @@ import ReactDOM from 'react-dom';
|
|||
import AppLayout from './App';
|
||||
|
||||
it('renders without crashing', () => {
|
||||
const div = document.createElement('div');
|
||||
ReactDOM.render(<AppLayout />, div);
|
||||
const div = document.createElement('div');
|
||||
ReactDOM.render(<AppLayout />, div);
|
||||
});
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,12 +1,20 @@
|
|||
import React from 'react';
|
||||
|
||||
export const AppFooter = (props) => {
|
||||
|
||||
return (
|
||||
<div className="layout-footer">
|
||||
<img src={props.layoutColorMode === 'light' ? 'assets/layout/images/logo-dark.svg' : 'assets/layout/images/logo-white.svg'} alt="Logo" height="20" className="mr-2" />
|
||||
by
|
||||
<span className="font-medium ml-2">PrimeReact</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<div className="layout-footer">
|
||||
<img
|
||||
src={
|
||||
props.layoutColorMode === 'light'
|
||||
? 'assets/layout/images/logo-dark.svg'
|
||||
: 'assets/layout/images/logo-white.svg'
|
||||
}
|
||||
alt="Logo"
|
||||
height="20"
|
||||
className="mr-2"
|
||||
/>
|
||||
by
|
||||
<span className="font-medium ml-2">PrimeReact</span>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -2,117 +2,175 @@ import React, { useState } from 'react';
|
|||
import { NavLink } from 'react-router-dom';
|
||||
import { CSSTransition } from 'react-transition-group';
|
||||
import classNames from 'classnames';
|
||||
import {Ripple} from "primereact/ripple";
|
||||
import { Ripple } from 'primereact/ripple';
|
||||
import { Badge } from 'primereact/badge';
|
||||
|
||||
const AppSubmenu = (props) => {
|
||||
const [activeIndex, setActiveIndex] = useState(null);
|
||||
|
||||
const [activeIndex, setActiveIndex] = useState(null)
|
||||
|
||||
const onMenuItemClick = (event, item, index) => {
|
||||
//avoid processing disabled items
|
||||
if (item.disabled) {
|
||||
event.preventDefault();
|
||||
return true;
|
||||
}
|
||||
|
||||
//execute command
|
||||
if (item.command) {
|
||||
item.command({ originalEvent: event, item: item });
|
||||
}
|
||||
|
||||
if (index === activeIndex)
|
||||
setActiveIndex(null);
|
||||
else
|
||||
setActiveIndex(index);
|
||||
|
||||
if (props.onMenuItemClick) {
|
||||
props.onMenuItemClick({
|
||||
originalEvent: event,
|
||||
item: item
|
||||
});
|
||||
}
|
||||
const onMenuItemClick = (event, item, index) => {
|
||||
//avoid processing disabled items
|
||||
if (item.disabled) {
|
||||
event.preventDefault();
|
||||
return true;
|
||||
}
|
||||
|
||||
const onKeyDown = (event) => {
|
||||
if (event.code === 'Enter' || event.code === 'Space'){
|
||||
event.preventDefault();
|
||||
event.target.click();
|
||||
}
|
||||
//execute command
|
||||
if (item.command) {
|
||||
item.command({ originalEvent: event, item: item });
|
||||
}
|
||||
|
||||
const renderLinkContent = (item) => {
|
||||
let submenuIcon = item.items && <i className="pi pi-fw pi-angle-down menuitem-toggle-icon"></i>;
|
||||
let badge = item.badge && <Badge value={item.badge} />
|
||||
if (index === activeIndex) setActiveIndex(null);
|
||||
else setActiveIndex(index);
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
<i className={item.icon}></i>
|
||||
<span>{item.label}</span>
|
||||
{submenuIcon}
|
||||
{badge}
|
||||
<Ripple/>
|
||||
</React.Fragment>
|
||||
);
|
||||
if (props.onMenuItemClick) {
|
||||
props.onMenuItemClick({
|
||||
originalEvent: event,
|
||||
item: item,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const renderLink = (item, i) => {
|
||||
let content = renderLinkContent(item);
|
||||
|
||||
if (item.to) {
|
||||
return (
|
||||
<NavLink aria-label={item.label} onKeyDown={onKeyDown} role="menuitem" className="p-ripple" activeClassName="router-link-active router-link-exact-active" to={item.to} onClick={(e) => onMenuItemClick(e, item, i)} exact target={item.target}>
|
||||
{content}
|
||||
</NavLink>
|
||||
)
|
||||
}
|
||||
else {
|
||||
return (
|
||||
<a tabIndex="0" aria-label={item.label} onKeyDown={onKeyDown} role="menuitem" href={item.url} className="p-ripple" onClick={(e) => onMenuItemClick(e, item, i)} target={item.target}>
|
||||
{content}
|
||||
</a>
|
||||
);
|
||||
}
|
||||
const onKeyDown = (event) => {
|
||||
if (event.code === 'Enter' || event.code === 'Space') {
|
||||
event.preventDefault();
|
||||
event.target.click();
|
||||
}
|
||||
};
|
||||
|
||||
let items = props.items && props.items.map((item, i) => {
|
||||
let active = activeIndex === i;
|
||||
let styleClass = classNames(item.badgeStyleClass, {'layout-menuitem-category': props.root, 'active-menuitem': active && !item.to });
|
||||
|
||||
if(props.root) {
|
||||
return (
|
||||
<li className={styleClass} key={i} role="none">
|
||||
{props.root === true && <React.Fragment>
|
||||
<div className="layout-menuitem-root-text" aria-label={item.label}>{item.label}</div>
|
||||
<AppSubmenu items={item.items} onMenuItemClick={props.onMenuItemClick} />
|
||||
</React.Fragment>}
|
||||
</li>
|
||||
);
|
||||
}
|
||||
else {
|
||||
return (
|
||||
<li className={styleClass} key={i} role="none">
|
||||
{renderLink(item, i)}
|
||||
<CSSTransition classNames="layout-submenu-wrapper" timeout={{ enter: 1000, exit: 450 }} in={active} unmountOnExit>
|
||||
<AppSubmenu items={item.items} onMenuItemClick={props.onMenuItemClick} />
|
||||
</CSSTransition>
|
||||
</li>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
return items ? <ul className={props.className} role="menu">{items}</ul> : null;
|
||||
}
|
||||
|
||||
export const AppMenu = (props) => {
|
||||
const renderLinkContent = (item) => {
|
||||
let submenuIcon = item.items && (
|
||||
<i className="pi pi-fw pi-angle-down menuitem-toggle-icon"></i>
|
||||
);
|
||||
let badge = item.badge && <Badge value={item.badge} />;
|
||||
|
||||
return (
|
||||
<div className="layout-menu-container">
|
||||
<AppSubmenu items={props.model} className="layout-menu" onMenuItemClick={props.onMenuItemClick} root={true} role="menu" />
|
||||
<a href="https://www.primefaces.org/primeblocks-react" className="block mt-3">
|
||||
<img alt="primeblocks" className="w-full"
|
||||
src={props.layoutColorMode === 'light' ? 'assets/layout/images/banner-primeblocks.png' : 'assets/layout/images/banner-primeblocks-dark.png'}/>
|
||||
</a>
|
||||
</div>
|
||||
<React.Fragment>
|
||||
<i className={item.icon}></i>
|
||||
<span>{item.label}</span>
|
||||
{submenuIcon}
|
||||
{badge}
|
||||
<Ripple />
|
||||
</React.Fragment>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const renderLink = (item, i) => {
|
||||
let content = renderLinkContent(item);
|
||||
|
||||
if (item.to) {
|
||||
return (
|
||||
<NavLink
|
||||
aria-label={item.label}
|
||||
onKeyDown={onKeyDown}
|
||||
role="menuitem"
|
||||
className="p-ripple"
|
||||
activeClassName="router-link-active router-link-exact-active"
|
||||
to={item.to}
|
||||
onClick={(e) => onMenuItemClick(e, item, i)}
|
||||
exact
|
||||
target={item.target}
|
||||
>
|
||||
{content}
|
||||
</NavLink>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<a
|
||||
tabIndex="0"
|
||||
aria-label={item.label}
|
||||
onKeyDown={onKeyDown}
|
||||
role="menuitem"
|
||||
href={item.url}
|
||||
className="p-ripple"
|
||||
onClick={(e) => onMenuItemClick(e, item, i)}
|
||||
target={item.target}
|
||||
>
|
||||
{content}
|
||||
</a>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
let items =
|
||||
props.items &&
|
||||
props.items.map((item, i) => {
|
||||
let active = activeIndex === i;
|
||||
let styleClass = classNames(item.badgeStyleClass, {
|
||||
'layout-menuitem-category': props.root,
|
||||
'active-menuitem': active && !item.to,
|
||||
});
|
||||
|
||||
if (props.root) {
|
||||
return (
|
||||
<li className={styleClass} key={i} role="none">
|
||||
{props.root === true && (
|
||||
<React.Fragment>
|
||||
<div
|
||||
className="layout-menuitem-root-text"
|
||||
aria-label={item.label}
|
||||
>
|
||||
{item.label}
|
||||
</div>
|
||||
<AppSubmenu
|
||||
items={item.items}
|
||||
onMenuItemClick={props.onMenuItemClick}
|
||||
/>
|
||||
</React.Fragment>
|
||||
)}
|
||||
</li>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<li className={styleClass} key={i} role="none">
|
||||
{renderLink(item, i)}
|
||||
<CSSTransition
|
||||
classNames="layout-submenu-wrapper"
|
||||
timeout={{ enter: 1000, exit: 450 }}
|
||||
in={active}
|
||||
unmountOnExit
|
||||
>
|
||||
<AppSubmenu
|
||||
items={item.items}
|
||||
onMenuItemClick={props.onMenuItemClick}
|
||||
/>
|
||||
</CSSTransition>
|
||||
</li>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
return items ? (
|
||||
<ul className={props.className} role="menu">
|
||||
{items}
|
||||
</ul>
|
||||
) : null;
|
||||
};
|
||||
|
||||
export const AppMenu = (props) => {
|
||||
return (
|
||||
<div className="layout-menu-container">
|
||||
<AppSubmenu
|
||||
items={props.model}
|
||||
className="layout-menu"
|
||||
onMenuItemClick={props.onMenuItemClick}
|
||||
root={true}
|
||||
role="menu"
|
||||
/>
|
||||
<a
|
||||
href="https://www.primefaces.org/primeblocks-react"
|
||||
className="block mt-3"
|
||||
>
|
||||
<img
|
||||
alt="primeblocks"
|
||||
className="w-full"
|
||||
src={
|
||||
props.layoutColorMode === 'light'
|
||||
? 'assets/layout/images/banner-primeblocks.png'
|
||||
: 'assets/layout/images/banner-primeblocks-dark.png'
|
||||
}
|
||||
/>
|
||||
</a>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -3,42 +3,44 @@ import { Link } from 'react-router-dom';
|
|||
import classNames from 'classnames';
|
||||
|
||||
export const AppTopbar = (props) => {
|
||||
return (
|
||||
<div className="layout-topbar">
|
||||
<Link to="/" className="layout-topbar-logo">
|
||||
<img src={'assets/layout/images/logo-dark.svg'} alt="logo" />
|
||||
<span>KATOIKIA</span>
|
||||
</Link>
|
||||
|
||||
return (
|
||||
<div className="layout-topbar">
|
||||
<Link to="/" className="layout-topbar-logo">
|
||||
<img src={'assets/layout/images/logo-dark.svg' } alt="logo" />
|
||||
<span>KATOIKIA</span>
|
||||
</Link>
|
||||
|
||||
{/* <button type="button" className="p-link layout-menu-button layout-topbar-button" onClick={props.onToggleMenuClick}>
|
||||
{/* <button type="button" className="p-link layout-menu-button layout-topbar-button" onClick={props.onToggleMenuClick}>
|
||||
<i className="pi pi-bars"/>
|
||||
</button> */}
|
||||
|
||||
<button type="button" className="p-link layout-topbar-menu-button layout-topbar-button" >
|
||||
<i className="pi pi-ellipsis-v" />
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="p-link layout-topbar-menu-button layout-topbar-button"
|
||||
>
|
||||
<i className="pi pi-ellipsis-v" />
|
||||
</button>
|
||||
|
||||
<ul className="layout-topbar-menu lg:flex origin-top">
|
||||
{/* <li>
|
||||
<ul className="layout-topbar-menu lg:flex origin-top">
|
||||
{/* <li>
|
||||
<button className="p-link layout-topbar-button" onClick={props.onMobileSubTopbarMenuClick}>
|
||||
<i className="pi pi-calendar"/>
|
||||
<span>Events</span>
|
||||
</button>
|
||||
</li> */}
|
||||
{/* <li>
|
||||
{/* <li>
|
||||
<button className="p-link layout-topbar-button" onClick={props.onMobileSubTopbarMenuClick}>
|
||||
<i className="pi pi-cog"/>
|
||||
<span>Settings</span>
|
||||
</button>
|
||||
</li> */}
|
||||
<li>
|
||||
<button className="p-link layout-topbar-button" >
|
||||
<i className="pi pi-user" />
|
||||
<span>Profile</span>
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
<li>
|
||||
<button className="p-link layout-topbar-button">
|
||||
<i className="pi pi-user" />
|
||||
<span>Profile</span>
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -3,47 +3,63 @@ import { classNames } from 'primereact/utils';
|
|||
import { CodeHighlight } from './templates/CodeHighlight';
|
||||
|
||||
const BlockViewer = (props) => {
|
||||
const [blockView, setBlockView] = useState('PREVIEW');
|
||||
|
||||
const [blockView, setBlockView] = useState('PREVIEW')
|
||||
const copyCode = async (event) => {
|
||||
await navigator.clipboard.writeText(props.code);
|
||||
event.preventDefault();
|
||||
};
|
||||
|
||||
const copyCode = async (event) => {
|
||||
await navigator.clipboard.writeText(props.code);
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="block-viewer">
|
||||
<div className="block-section">
|
||||
<div className="block-header">
|
||||
<span className="block-title">
|
||||
<span>{props.header}</span>
|
||||
{props.new && <span className="badge-new">New</span>}
|
||||
</span>
|
||||
<div className="block-actions">
|
||||
<button tabIndex="0" className={classNames('p-link', { 'block-action-active': blockView === 'PREVIEW' })} onClick={() => setBlockView('PREVIEW')}><span>Preview</span></button>
|
||||
<button className={classNames('p-link', { 'block-action-active': blockView === 'CODE' })} onClick={() => setBlockView('CODE')} >
|
||||
<span>Code</span>
|
||||
</button>
|
||||
<button tabIndex="0" className="p-link block-action-copy" onClick={copyCode}>
|
||||
<i className="pi pi-copy"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="block-content">
|
||||
{blockView === 'PREVIEW' &&
|
||||
<div className={props.containerClassName} style={props.previewStyle}>
|
||||
{props.children}
|
||||
</div>}
|
||||
|
||||
{blockView === 'CODE' &&
|
||||
<CodeHighlight>
|
||||
{props.code}
|
||||
</CodeHighlight>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
return (
|
||||
<div className="block-viewer">
|
||||
<div className="block-section">
|
||||
<div className="block-header">
|
||||
<span className="block-title">
|
||||
<span>{props.header}</span>
|
||||
{props.new && <span className="badge-new">New</span>}
|
||||
</span>
|
||||
<div className="block-actions">
|
||||
<button
|
||||
tabIndex="0"
|
||||
className={classNames('p-link', {
|
||||
'block-action-active': blockView === 'PREVIEW',
|
||||
})}
|
||||
onClick={() => setBlockView('PREVIEW')}
|
||||
>
|
||||
<span>Preview</span>
|
||||
</button>
|
||||
<button
|
||||
className={classNames('p-link', {
|
||||
'block-action-active': blockView === 'CODE',
|
||||
})}
|
||||
onClick={() => setBlockView('CODE')}
|
||||
>
|
||||
<span>Code</span>
|
||||
</button>
|
||||
<button
|
||||
tabIndex="0"
|
||||
className="p-link block-action-copy"
|
||||
onClick={copyCode}
|
||||
>
|
||||
<i className="pi pi-copy"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
<div className="block-content">
|
||||
{blockView === 'PREVIEW' && (
|
||||
<div
|
||||
className={props.containerClassName}
|
||||
style={props.previewStyle}
|
||||
>
|
||||
{props.children}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{blockView === 'CODE' && <CodeHighlight>{props.code}</CodeHighlight>}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default BlockViewer;
|
||||
|
|
|
@ -2,14 +2,13 @@ import { useEffect } from 'react';
|
|||
import { useLocation, withRouter } from 'react-router-dom';
|
||||
|
||||
const ScrollToTop = (props) => {
|
||||
let location = useLocation();
|
||||
|
||||
let location = useLocation();
|
||||
useEffect(() => {
|
||||
window.scrollTo(0, 0);
|
||||
}, [location]);
|
||||
|
||||
useEffect(() => {
|
||||
window.scrollTo(0, 0)
|
||||
}, [location]);
|
||||
|
||||
return props.children;
|
||||
}
|
||||
return props.children;
|
||||
};
|
||||
|
||||
export default withRouter(ScrollToTop);
|
||||
|
|
|
@ -1,95 +1,95 @@
|
|||
.customer-badge,
|
||||
.product-badge,
|
||||
.order-badge {
|
||||
border-radius: var(--border-radius);
|
||||
padding: .25em .5rem;
|
||||
text-transform: uppercase;
|
||||
font-weight: 700;
|
||||
font-size: 12px;
|
||||
letter-spacing: .3px;
|
||||
border-radius: var(--border-radius);
|
||||
padding: 0.25em 0.5rem;
|
||||
text-transform: uppercase;
|
||||
font-weight: 700;
|
||||
font-size: 12px;
|
||||
letter-spacing: 0.3px;
|
||||
}
|
||||
|
||||
.customer-badge {
|
||||
&.status-qualified {
|
||||
background: #C8E6C9;
|
||||
color: #256029;
|
||||
}
|
||||
&.status-qualified {
|
||||
background: #c8e6c9;
|
||||
color: #256029;
|
||||
}
|
||||
|
||||
&.status-unqualified {
|
||||
background: #FFCDD2;
|
||||
color: #C63737;
|
||||
}
|
||||
&.status-unqualified {
|
||||
background: #ffcdd2;
|
||||
color: #c63737;
|
||||
}
|
||||
|
||||
&.status-negotiation {
|
||||
background: #FEEDAF;
|
||||
color: #8A5340;
|
||||
}
|
||||
&.status-negotiation {
|
||||
background: #feedaf;
|
||||
color: #8a5340;
|
||||
}
|
||||
|
||||
&.status-new {
|
||||
background: #B3E5FC;
|
||||
color: #23547B;
|
||||
}
|
||||
&.status-new {
|
||||
background: #b3e5fc;
|
||||
color: #23547b;
|
||||
}
|
||||
|
||||
&.status-renewal {
|
||||
background: #ECCFFF;
|
||||
color: #694382;
|
||||
}
|
||||
&.status-renewal {
|
||||
background: #eccfff;
|
||||
color: #694382;
|
||||
}
|
||||
|
||||
&.status-proposal {
|
||||
background: #FFD8B2;
|
||||
color: #805B36;
|
||||
}
|
||||
&.status-proposal {
|
||||
background: #ffd8b2;
|
||||
color: #805b36;
|
||||
}
|
||||
}
|
||||
|
||||
.product-badge {
|
||||
border-radius: var(--border-radius);
|
||||
padding: .25em .5rem;
|
||||
text-transform: uppercase;
|
||||
font-weight: 700;
|
||||
font-size: 12px;
|
||||
letter-spacing: .3px;
|
||||
border-radius: var(--border-radius);
|
||||
padding: 0.25em 0.5rem;
|
||||
text-transform: uppercase;
|
||||
font-weight: 700;
|
||||
font-size: 12px;
|
||||
letter-spacing: 0.3px;
|
||||
|
||||
&.status-instock {
|
||||
background: #C8E6C9;
|
||||
color: #256029;
|
||||
}
|
||||
&.status-instock {
|
||||
background: #c8e6c9;
|
||||
color: #256029;
|
||||
}
|
||||
|
||||
&.status-outofstock {
|
||||
background: #FFCDD2;
|
||||
color: #C63737;
|
||||
}
|
||||
&.status-outofstock {
|
||||
background: #ffcdd2;
|
||||
color: #c63737;
|
||||
}
|
||||
|
||||
&.status-lowstock {
|
||||
background: #FEEDAF;
|
||||
color: #8A5340;
|
||||
}
|
||||
&.status-lowstock {
|
||||
background: #feedaf;
|
||||
color: #8a5340;
|
||||
}
|
||||
}
|
||||
|
||||
.order-badge {
|
||||
border-radius: var(--border-radius);
|
||||
padding: .25em .5rem;
|
||||
text-transform: uppercase;
|
||||
font-weight: 700;
|
||||
font-size: 12px;
|
||||
letter-spacing: .3px;
|
||||
border-radius: var(--border-radius);
|
||||
padding: 0.25em 0.5rem;
|
||||
text-transform: uppercase;
|
||||
font-weight: 700;
|
||||
font-size: 12px;
|
||||
letter-spacing: 0.3px;
|
||||
|
||||
&.order-delivered {
|
||||
background: #C8E6C9;
|
||||
color: #256029;
|
||||
}
|
||||
&.order-delivered {
|
||||
background: #c8e6c9;
|
||||
color: #256029;
|
||||
}
|
||||
|
||||
&.order-cancelled {
|
||||
background: #FFCDD2;
|
||||
color: #C63737;
|
||||
}
|
||||
&.order-cancelled {
|
||||
background: #ffcdd2;
|
||||
color: #c63737;
|
||||
}
|
||||
|
||||
&.order-pending {
|
||||
background: #FEEDAF;
|
||||
color: #8A5340;
|
||||
}
|
||||
&.order-pending {
|
||||
background: #feedaf;
|
||||
color: #8a5340;
|
||||
}
|
||||
|
||||
&.order-returned {
|
||||
background: #ECCFFF;
|
||||
color: #694382;
|
||||
}
|
||||
&.order-returned {
|
||||
background: #eccfff;
|
||||
color: #694382;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,147 +1,149 @@
|
|||
.block-viewer {
|
||||
.block-section {
|
||||
margin-bottom: 4rem;
|
||||
overflow: hidden;
|
||||
.block-section {
|
||||
margin-bottom: 4rem;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.block-header {
|
||||
padding: 1rem 2rem;
|
||||
background-color: var(--surface-section);
|
||||
border-top-left-radius: 12px;
|
||||
border-top-right-radius: 12px;
|
||||
border: 1px solid var(--surface-d);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
.block-title {
|
||||
font-weight: 700;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
|
||||
.badge-free {
|
||||
border-radius: 4px;
|
||||
padding: 0.25rem 0.5rem;
|
||||
background-color: var(--orange-500);
|
||||
color: white;
|
||||
margin-left: 1rem;
|
||||
font-weight: 700;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
}
|
||||
|
||||
.block-header {
|
||||
padding: 1rem 2rem;
|
||||
background-color: var(--surface-section);
|
||||
border-top-left-radius: 12px;
|
||||
border-top-right-radius: 12px;
|
||||
border:1px solid var(--surface-d);
|
||||
.block-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
user-select: none;
|
||||
margin-left: 1rem;
|
||||
|
||||
a,
|
||||
button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-right: 0.75rem;
|
||||
padding: 0.5rem 1rem;
|
||||
border-radius: 4px;
|
||||
font-weight: 600;
|
||||
border: 1px solid transparent;
|
||||
transition: background-color 0.2s;
|
||||
cursor: pointer;
|
||||
|
||||
.block-title {
|
||||
font-weight: 700;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
|
||||
.badge-free {
|
||||
border-radius: 4px;
|
||||
padding: .25rem .5rem;
|
||||
background-color: var(--orange-500);
|
||||
color: white;
|
||||
margin-left: 1rem;
|
||||
font-weight: 700;
|
||||
font-size: .875rem;
|
||||
}
|
||||
&:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.block-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
user-select: none;
|
||||
margin-left: 1rem;
|
||||
|
||||
a,button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-right: .75rem;
|
||||
padding: .5rem 1rem;
|
||||
border-radius: 4px;
|
||||
font-weight: 600;
|
||||
border: 1px solid transparent;
|
||||
transition: background-color .2s;
|
||||
cursor: pointer;
|
||||
|
||||
&:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
&:not(.block-action-disabled):hover {
|
||||
background-color: var(--surface-c);
|
||||
}
|
||||
|
||||
&.block-action-active {
|
||||
border-color: var(--primary-color);
|
||||
color: var(--primary-color);
|
||||
}
|
||||
|
||||
&.block-action-copy {
|
||||
i {
|
||||
color: var(--primary-color);
|
||||
font-size: 1.25rem;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&.block-action-disabled {
|
||||
opacity: .6;
|
||||
cursor: auto !important;
|
||||
}
|
||||
|
||||
i {
|
||||
margin-right: .5rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.block-content {
|
||||
padding: 0;
|
||||
border:1px solid var(--surface-d);
|
||||
border-top: 0 none;
|
||||
border-bottom-left-radius: 12px;
|
||||
border-bottom-right-radius: 12px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
pre[class*="language-"] {
|
||||
margin: 0 !important;
|
||||
|
||||
&:before, &:after {
|
||||
display: none !important;
|
||||
&:not(.block-action-disabled):hover {
|
||||
background-color: var(--surface-c);
|
||||
}
|
||||
|
||||
code {
|
||||
border-left: 0 none !important;
|
||||
box-shadow: none !important;
|
||||
background: var(--surface-e) !important;
|
||||
&.block-action-active {
|
||||
border-color: var(--primary-color);
|
||||
color: var(--primary-color);
|
||||
}
|
||||
|
||||
&.block-action-copy {
|
||||
i {
|
||||
color: var(--primary-color);
|
||||
font-size: 1.25rem;
|
||||
margin: 0;
|
||||
color: var(--text-color);
|
||||
font-size: 14px;
|
||||
padding: 0 2rem !important;
|
||||
|
||||
.token {
|
||||
&.tag,
|
||||
&.keyword {
|
||||
color: #2196F3 !important;
|
||||
}
|
||||
|
||||
&.attr-name,
|
||||
&.attr-string {
|
||||
color: #2196F3 !important;
|
||||
}
|
||||
|
||||
&.attr-value {
|
||||
color: #4CAF50 !important;
|
||||
}
|
||||
|
||||
&.punctuation {
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
&.operator,
|
||||
&.string {
|
||||
background: transparent;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.block-action-disabled {
|
||||
opacity: 0.6;
|
||||
cursor: auto !important;
|
||||
}
|
||||
|
||||
i {
|
||||
margin-right: 0.5rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.block-content {
|
||||
padding: 0;
|
||||
border: 1px solid var(--surface-d);
|
||||
border-top: 0 none;
|
||||
border-bottom-left-radius: 12px;
|
||||
border-bottom-right-radius: 12px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
pre[class*='language-'] {
|
||||
margin: 0 !important;
|
||||
|
||||
&:before,
|
||||
&:after {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 575px) {
|
||||
.block-header {
|
||||
flex-direction: column;
|
||||
align-items: start;
|
||||
code {
|
||||
border-left: 0 none !important;
|
||||
box-shadow: none !important;
|
||||
background: var(--surface-e) !important;
|
||||
margin: 0;
|
||||
color: var(--text-color);
|
||||
font-size: 14px;
|
||||
padding: 0 2rem !important;
|
||||
|
||||
.block-actions {
|
||||
margin-top: 1rem;
|
||||
margin-left: 0;
|
||||
}
|
||||
.token {
|
||||
&.tag,
|
||||
&.keyword {
|
||||
color: #2196f3 !important;
|
||||
}
|
||||
|
||||
&.attr-name,
|
||||
&.attr-string {
|
||||
color: #2196f3 !important;
|
||||
}
|
||||
|
||||
&.attr-value {
|
||||
color: #4caf50 !important;
|
||||
}
|
||||
|
||||
&.punctuation {
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
&.operator,
|
||||
&.string {
|
||||
background: transparent;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 575px) {
|
||||
.block-header {
|
||||
flex-direction: column;
|
||||
align-items: start;
|
||||
|
||||
.block-actions {
|
||||
margin-top: 1rem;
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,4 +3,4 @@
|
|||
@import './MediaDemo.scss';
|
||||
@import './TableDemo.scss';
|
||||
@import './TimelineDemo.scss';
|
||||
@import './Badge.scss';
|
||||
@import './Badge.scss';
|
||||
|
|
|
@ -1,60 +1,61 @@
|
|||
.docs {
|
||||
i:not([class~="pi"]) {
|
||||
background-color: transparent;
|
||||
color: #2196f3;
|
||||
font-family: Monaco, courier, monospace;
|
||||
font-style: normal;
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
padding: 0 4px;
|
||||
letter-spacing: .5px;
|
||||
font-weight: 600;
|
||||
margin: 0 2px;
|
||||
display: inline-flex;
|
||||
i:not([class~='pi']) {
|
||||
background-color: transparent;
|
||||
color: #2196f3;
|
||||
font-family: Monaco, courier, monospace;
|
||||
font-style: normal;
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
padding: 0 4px;
|
||||
letter-spacing: 0.5px;
|
||||
font-weight: 600;
|
||||
margin: 0 2px;
|
||||
display: inline-flex;
|
||||
}
|
||||
|
||||
a {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
pre[class*='language-'] {
|
||||
&:before,
|
||||
&:after {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
a {
|
||||
font-weight: 500;
|
||||
code {
|
||||
border-left: 6px solid var(--surface-border) !important;
|
||||
box-shadow: none !important;
|
||||
background: var(--surface-ground) !important;
|
||||
margin: 1em 0;
|
||||
color: var(--text-color);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
pre[class*="language-"] {
|
||||
&:before, &:after {
|
||||
display: none !important;
|
||||
}
|
||||
.token {
|
||||
&.tag,
|
||||
&.keyword {
|
||||
color: #2196f3 !important;
|
||||
}
|
||||
|
||||
code {
|
||||
border-left: 6px solid var(--surface-border) !important;
|
||||
box-shadow: none !important;
|
||||
background: var(--surface-ground) !important;
|
||||
margin: 1em 0;
|
||||
color: var(--text-color);
|
||||
font-size: 14px;
|
||||
}
|
||||
&.attr-name,
|
||||
&.attr-string {
|
||||
color: #2196f3 !important;
|
||||
}
|
||||
|
||||
.token {
|
||||
&.tag,
|
||||
&.keyword {
|
||||
color: #2196F3 !important;
|
||||
}
|
||||
&.attr-value {
|
||||
color: #4caf50 !important;
|
||||
}
|
||||
|
||||
&.attr-name,
|
||||
&.attr-string {
|
||||
color: #2196F3 !important;
|
||||
}
|
||||
&.punctuation {
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
&.attr-value {
|
||||
color: #4CAF50 !important;
|
||||
}
|
||||
|
||||
&.punctuation {
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
&.operator,
|
||||
&.variable,
|
||||
&.string {
|
||||
background: transparent;
|
||||
}
|
||||
}
|
||||
&.operator,
|
||||
&.variable,
|
||||
&.string {
|
||||
background: transparent;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue