run formatter for first time

This commit is contained in:
Eduardo Quiros 2022-07-24 22:38:48 -06:00
parent 3e5ced6fb0
commit 6b49604d4b
No known key found for this signature in database
GPG Key ID: B77F36C3F12720B4
148 changed files with 12443 additions and 8203 deletions

View File

@ -1,8 +1,8 @@
import { Controller, Get, Post, Body, Param, Delete } from '@nestjs/common'; import { Controller, Get, Post, Body, Param, Delete } from '@nestjs/common';
import { AppService } from "./app.service"; import { AppService } from './app.service';
@Controller() @Controller()
export class AppController { export class AppController {
constructor(private readonly appService: AppService) { } constructor(private readonly appService: AppService) {}
// #==== API Users // #==== API Users
@Post('user/createAdminSystem') @Post('user/createAdminSystem')
createAdminSystem( createAdminSystem(
@ -16,8 +16,17 @@ export class AppController {
@Body('status') status: string, @Body('status') status: string,
@Body('date_entry') date_entry: Date, @Body('date_entry') date_entry: Date,
) { ) {
return this.appService.createAdminSystem(dni, name, last_name, email, phone, password, return this.appService.createAdminSystem(
user_type, status, date_entry); dni,
name,
last_name,
email,
phone,
password,
user_type,
status,
date_entry,
);
} }
@Post('user/createGuard') @Post('user/createGuard')
@ -32,10 +41,20 @@ export class AppController {
@Body('user_type') user_type: string, @Body('user_type') user_type: string,
@Body('status') status: string, @Body('status') status: string,
@Body('date_entry') date_entry: Date, @Body('date_entry') date_entry: Date,
@Body('community_id') community_id:string @Body('community_id') community_id: string,
) { ) {
return this.appService.createGuard(dni, name, last_name, email, phone, password, return this.appService.createGuard(
user_type, status, date_entry,community_id); dni,
name,
last_name,
email,
phone,
password,
user_type,
status,
date_entry,
community_id,
);
} }
@Post('user/createUser') @Post('user/createUser')
@ -51,8 +70,18 @@ export class AppController {
@Body('date_entry') date_entry: Date, @Body('date_entry') date_entry: Date,
@Body('community_id') community_id: string, @Body('community_id') community_id: string,
) { ) {
return this.appService.createUser(dni, name, last_name, email, phone, password, return this.appService.createUser(
user_type, status, date_entry, community_id); dni,
name,
last_name,
email,
phone,
password,
user_type,
status,
date_entry,
community_id,
);
} }
@Get('user/allUsers') @Get('user/allUsers')
@ -65,7 +94,7 @@ export class AppController {
@Body('email') pEmail: string, @Body('email') pEmail: string,
@Body('password') pPassword: string, @Body('password') pPassword: string,
) { ) {
return this.appService.inicioSesion(pEmail,pPassword); return this.appService.inicioSesion(pEmail, pPassword);
} }
@Get('user/findAdminSistema') @Get('user/findAdminSistema')
@ -78,24 +107,17 @@ export class AppController {
return this.appService.allUsersAdminComunidad(); return this.appService.allUsersAdminComunidad();
} }
@Get('user/findGuards/:community') @Get('user/findGuards/:community')
findGuardsCommunity( findGuardsCommunity(@Param('community_id') community_id: string) {
@Param('community_id') community_id: string
) {
return this.appService.findGuardsCommunity(community_id); return this.appService.findGuardsCommunity(community_id);
} }
@Get('user/find/:dni') @Get('user/find/:dni')
findUser( findUser(@Param('dni') paramUserDNI: string) {
@Param('dni') paramUserDNI: string
) {
return this.appService.findUser(paramUserDNI); return this.appService.findUser(paramUserDNI);
} }
@Delete('user/deleteAdminSystem/:id') @Delete('user/deleteAdminSystem/:id')
deleteAdminSystem( deleteAdminSystem(@Param('id') id: string) {
@Param('id') id: string,
) {
return this.appService.deleteAdminSystem(id); return this.appService.deleteAdminSystem(id);
} }
@ -111,11 +133,18 @@ export class AppController {
@Body('status') status: string, @Body('status') status: string,
@Body('date_entry') date_entry: Date, @Body('date_entry') date_entry: Date,
@Body('houses') houses: [], @Body('houses') houses: [],
) { ) {
return this.appService.createCommunity(name, province, canton, return this.appService.createCommunity(
district, num_houses, phone, name,
status, date_entry, houses); province,
canton,
district,
num_houses,
phone,
status,
date_entry,
houses,
);
} }
@Get('community/allCommunities') @Get('community/allCommunities')
@ -124,25 +153,17 @@ export class AppController {
} }
@Get('community/findCommunity/:id') @Get('community/findCommunity/:id')
findCommunity( findCommunity(@Param('id') paramCommunityId: string) {
@Param('id') paramCommunityId: string
) {
return this.appService.findCommunity(paramCommunityId); return this.appService.findCommunity(paramCommunityId);
} }
@Get('community/findCommunityName/:id') @Get('community/findCommunityName/:id')
findCommunityName( findCommunityName(@Param('id') paramCommunityId: string) {
@Param('id') paramCommunityId: string
) {
return this.appService.findCommunityName(paramCommunityId); return this.appService.findCommunityName(paramCommunityId);
} }
@Post('community/findCommunityAdmin') @Post('community/findCommunityAdmin')
findCommunityAdmin( findCommunityAdmin(@Body('community_id') community_id: string) {
@Body('community_id') community_id: string,
) {
return this.appService.findCommunityAdmin(community_id); return this.appService.findCommunityAdmin(community_id);
} }
@ -155,22 +176,22 @@ export class AppController {
@Body('bookable') bookable: number, @Body('bookable') bookable: number,
@Body('community_id') community_id: string, @Body('community_id') community_id: string,
) { ) {
return this.appService.createCommonArea(
return this.appService.createCommonArea(name, hourMin, hourMax, name,
bookable, community_id); hourMin,
hourMax,
bookable,
community_id,
);
} }
@Get('commonArea/allCommonAreas') @Get('commonArea/allCommonAreas')
allCommonAreas() { allCommonAreas() {
return this.appService.allCommonAreas(); return this.appService.allCommonAreas();
} }
@Get('commonArea/findCommonArea/:id') @Get('commonArea/findCommonArea/:id')
findCommonArea( findCommonArea(@Param('id') paramCommonAreaId: string) {
@Param('id') paramCommonAreaId: string
) {
return this.appService.findCommonArea(paramCommonAreaId); return this.appService.findCommonArea(paramCommonAreaId);
} }
@ -186,7 +207,15 @@ export class AppController {
@Body('status') status: string, @Body('status') status: string,
@Body('date_entry') date_entry: Date, @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') @Get('guest/allGuests')
@ -195,13 +224,10 @@ export class AppController {
} }
@Get('guest/find/:dni') @Get('guest/find/:dni')
findGuest( findGuest(@Param('dni') paramGuestDNI: string) {
@Param('dni') paramGuestDNI: string
) {
return this.appService.findGuest(paramGuestDNI); return this.appService.findGuest(paramGuestDNI);
} }
// #==== API Payment // #==== API Payment
@Post('payment/createPayment') @Post('payment/createPayment')
@ -214,8 +240,15 @@ export class AppController {
@Body('user_id') user_id: string, @Body('user_id') user_id: string,
@Body('communty_id') communty_id: string, @Body('communty_id') communty_id: string,
) { ) {
return this.appService.createPayment(date_payment, mount, description, return this.appService.createPayment(
period, status, user_id, communty_id); date_payment,
mount,
description,
period,
status,
user_id,
communty_id,
);
} }
@Get('payment/allPayments') @Get('payment/allPayments')
@ -224,9 +257,7 @@ export class AppController {
} }
@Get('payment/find/:dni') @Get('payment/find/:dni')
findPayment( findPayment(@Param('dni') paramPaymentDNI: string) {
@Param('dni') paramPaymentDNI: string
) {
return this.appService.findPayment(paramPaymentDNI); return this.appService.findPayment(paramPaymentDNI);
} }
@ -241,8 +272,14 @@ export class AppController {
@Body('user_id') user_id: string, @Body('user_id') user_id: string,
@Body('common_area_id') common_area_id: string, @Body('common_area_id') common_area_id: string,
) { ) {
return this.appService.createReservation(start_time, finish_time, status, return this.appService.createReservation(
date_entry, user_id, common_area_id); start_time,
finish_time,
status,
date_entry,
user_id,
common_area_id,
);
} }
@Get('reservation/allReservations') @Get('reservation/allReservations')
@ -251,13 +288,10 @@ export class AppController {
} }
@Get('reservation/find/:id') @Get('reservation/find/:id')
findReservation( findReservation(@Param('id') paramReservation: string) {
@Param('id') paramReservation: string
) {
return this.appService.findReservation(paramReservation); return this.appService.findReservation(paramReservation);
} }
// #==== API Post // #==== API Post
@Post('post/createPost') @Post('post/createPost')
@ -276,13 +310,10 @@ export class AppController {
} }
@Get('post/find/:id') @Get('post/find/:id')
findPost( findPost(@Param('id') paramPost: string) {
@Param('id') paramPost: string
) {
return this.appService.findPost(paramPost); return this.appService.findPost(paramPost);
} }
// #==== API Comment // #==== API Comment
@Post('post/createComment') @Post('post/createComment')
@ -301,14 +332,10 @@ export class AppController {
} }
@Get('post/findComment/:id') @Get('post/findComment/:id')
findComment( findComment(@Param('id') paramComment: string) {
@Param('id') paramComment: string
) {
return this.appService.findComment(paramComment); return this.appService.findComment(paramComment);
} }
// #==== API Report // #==== API Report
@Post('report/createReport') @Post('report/createReport')
@ -318,7 +345,12 @@ export class AppController {
@Body('date_entry') date_entry: Date, @Body('date_entry') date_entry: Date,
@Body('user_id') user_id: string, @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') @Get('report/allReports')
@ -327,26 +359,16 @@ export class AppController {
} }
@Get('report/find/:id') @Get('report/find/:id')
findReport( findReport(@Param('id') paramReport: string) {
@Param('id') paramReport: string
) {
return this.appService.findReport(paramReport); return this.appService.findReport(paramReport);
} }
@Post('email/sendMail') @Post('email/sendMail')
senMail( senMail(@Body('email') email: string) {
@Body('email') email: string,
) {
return this.appService.sendMail(email); return this.appService.sendMail(email);
} }
@Post('email/html') @Post('email/html')
html( html(@Body('email') email: string, @Body('name') name: string) {
@Body('email') email: string,
@Body('name') name: string,
) {
return this.appService.html(email, name); return this.appService.html(email, name);
} }
} }

View File

@ -1,99 +1,99 @@
import { Module } from '@nestjs/common'; import { Module } from '@nestjs/common';
import { AppController } from './app.controller'; import { AppController } from './app.controller';
import { ClientsModule, Transport } from "@nestjs/microservices"; import { ClientsModule, Transport } from '@nestjs/microservices';
import { AppService } from './app.service'; import { AppService } from './app.service';
@Module({ @Module({
imports: [ imports: [
ClientsModule.register([ ClientsModule.register([
{ {
name: "SERVICIO_USUARIOS", name: 'SERVICIO_USUARIOS',
transport: Transport.TCP, transport: Transport.TCP,
options: { options: {
host: "127.0.0.1", host: '127.0.0.1',
port: 3001 port: 3001,
} },
} },
]), ]),
ClientsModule.register([ ClientsModule.register([
{ {
name: "SERVICIO_COMUNIDADES", name: 'SERVICIO_COMUNIDADES',
transport: Transport.TCP, transport: Transport.TCP,
options: { options: {
host: "127.0.0.1", host: '127.0.0.1',
port: 3002 port: 3002,
} },
} },
]), ]),
ClientsModule.register([ ClientsModule.register([
{ {
name: "SERVICIO_AREAS_COMUNES", name: 'SERVICIO_AREAS_COMUNES',
transport: Transport.TCP, transport: Transport.TCP,
options: { options: {
host: "127.0.0.1", host: '127.0.0.1',
port: 3003 port: 3003,
} },
} },
]), ]),
ClientsModule.register([ ClientsModule.register([
{ {
name: "SERVICIO_INVITADOS", name: 'SERVICIO_INVITADOS',
transport: Transport.TCP, transport: Transport.TCP,
options: { options: {
host: "127.0.0.1", host: '127.0.0.1',
port: 3004 port: 3004,
} },
} },
]), ]),
ClientsModule.register([ ClientsModule.register([
{ {
name: "SERVICIO_PAGOS", name: 'SERVICIO_PAGOS',
transport: Transport.TCP, transport: Transport.TCP,
options: { options: {
host: "127.0.0.1", host: '127.0.0.1',
port: 3005 port: 3005,
} },
} },
]), ]),
ClientsModule.register([ ClientsModule.register([
{ {
name: "SERVICIO_RESERVACIONES", name: 'SERVICIO_RESERVACIONES',
transport: Transport.TCP, transport: Transport.TCP,
options: { options: {
host: "127.0.0.1", host: '127.0.0.1',
port: 3006 port: 3006,
} },
} },
]), ]),
ClientsModule.register([ ClientsModule.register([
{ {
name: "SERVICIO_POSTS", name: 'SERVICIO_POSTS',
transport: Transport.TCP, transport: Transport.TCP,
options: { options: {
host: "127.0.0.1", host: '127.0.0.1',
port: 3007 port: 3007,
} },
} },
]),
ClientsModule.register([
{
name: "SERVICIO_REPORTES",
transport: Transport.TCP,
options: {
host: "127.0.0.1",
port: 3008
}
}
]), ]),
ClientsModule.register([ ClientsModule.register([
{ {
name: "SERVICIO_NOTIFICACIONES", name: 'SERVICIO_REPORTES',
transport: Transport.TCP, transport: Transport.TCP,
options: { options: {
host: "127.0.0.1", host: '127.0.0.1',
port: 3009 port: 3008,
} },
} },
]),
ClientsModule.register([
{
name: 'SERVICIO_NOTIFICACIONES',
transport: Transport.TCP,
options: {
host: '127.0.0.1',
port: 3009,
},
},
]), ]),
], ],
controllers: [AppController], controllers: [AppController],

View File

@ -1,68 +1,115 @@
import { Injectable, Inject } from '@nestjs/common'; import { Injectable, Inject } from '@nestjs/common';
import { ClientProxy } from "@nestjs/microservices"; import { ClientProxy } from '@nestjs/microservices';
import { map } from "rxjs/operators"; import { map } from 'rxjs/operators';
@Injectable() @Injectable()
export class AppService { export class AppService {
constructor( constructor(
@Inject('SERVICIO_USUARIOS') private readonly clientUserApp: ClientProxy, @Inject('SERVICIO_USUARIOS') private readonly clientUserApp: ClientProxy,
@Inject('SERVICIO_COMUNIDADES') private readonly clientCommunityApp: ClientProxy, @Inject('SERVICIO_COMUNIDADES')
@Inject('SERVICIO_AREAS_COMUNES') private readonly clientCommonAreaApp: ClientProxy, private readonly clientCommunityApp: ClientProxy,
@Inject('SERVICIO_AREAS_COMUNES')
private readonly clientCommonAreaApp: ClientProxy,
@Inject('SERVICIO_INVITADOS') private readonly clientGuestApp: ClientProxy, @Inject('SERVICIO_INVITADOS') private readonly clientGuestApp: ClientProxy,
@Inject('SERVICIO_PAGOS') private readonly clientPaymentApp: 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_POSTS') private readonly clientPostApp: ClientProxy,
@Inject('SERVICIO_REPORTES') private readonly clientReportApp: 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 //POST parameter from API
createUser(dni: string, name: string, last_name: string, email: string, phone: number createUser(
, password: string, user_type: string, status: string, date_entry: Date, community_id: string) { 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 pattern = { cmd: 'createUser' };
const payload = { const payload = {
dni: dni, name: name, last_name: last_name, email: email, phone: phone, dni: dni,
password: password, user_type: user_type, status: status, date_entry: date_entry, name: name,
community_id: community_id 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 return this.clientUserApp
.send<string>(pattern, payload) .send<string>(pattern, payload)
.pipe( .pipe(map((message: string) => ({ message })));
map((message: string) => ({ message })),
);
} }
//POST parameter from API //POST parameter from API
createAdminSystem(dni: string, name: string, last_name: string, email: string, phone: number createAdminSystem(
, password: string, user_type: string, status: string, date_entry: Date) { dni: string,
name: string,
last_name: string,
email: string,
phone: number,
password: string,
user_type: string,
status: string,
date_entry: Date,
) {
const pattern = { cmd: 'createAdminSystem' }; const pattern = { cmd: 'createAdminSystem' };
const payload = { const payload = {
dni: dni, name: name, last_name: last_name, email: email, phone: phone, dni: dni,
password: password, user_type: user_type, status: status, date_entry: date_entry name: name,
last_name: last_name,
email: email,
phone: phone,
password: password,
user_type: user_type,
status: status,
date_entry: date_entry,
}; };
return this.clientUserApp return this.clientUserApp
.send<string>(pattern, payload) .send<string>(pattern, payload)
.pipe( .pipe(map((message: string) => ({ message })));
map((message: string) => ({ message })),
);
} }
createGuard(dni: string, name: string, last_name: string, email: string, phone: number createGuard(
, password: string, user_type: string, status: string, date_entry: Date, community_id: string) { 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: 'createGuard' }; const pattern = { cmd: 'createGuard' };
const payload = { const payload = {
dni: dni, name: name, last_name: last_name, email: email, phone: phone, dni: dni,
password: password, user_type: user_type, status: status, date_entry: date_entry, community_id name: name,
last_name: last_name,
email: email,
phone: phone,
password: password,
user_type: user_type,
status: status,
date_entry: date_entry,
community_id,
}; };
return this.clientUserApp return this.clientUserApp
.send<string>(pattern, payload) .send<string>(pattern, payload)
.pipe( .pipe(map((message: string) => ({ message })));
map((message: string) => ({ message })),
);
} }
allUsers() { allUsers() {
@ -70,9 +117,7 @@ export class AppService {
const payload = {}; const payload = {};
return this.clientUserApp return this.clientUserApp
.send<string>(pattern, payload) .send<string>(pattern, payload)
.pipe( .pipe(map((message: string) => ({ message })));
map((message: string) => ({ message })),
);
} }
allUsersAdminSistema() { allUsersAdminSistema() {
@ -80,9 +125,7 @@ export class AppService {
const payload = {}; const payload = {};
return this.clientUserApp return this.clientUserApp
.send<string>(pattern, payload) .send<string>(pattern, payload)
.pipe( .pipe(map((message: string) => ({ message })));
map((message: string) => ({ message })),
);
} }
allUsersAdminComunidad() { allUsersAdminComunidad() {
@ -90,9 +133,7 @@ export class AppService {
const payload = {}; const payload = {};
return this.clientUserApp return this.clientUserApp
.send<string>(pattern, payload) .send<string>(pattern, payload)
.pipe( .pipe(map((message: string) => ({ message })));
map((message: string) => ({ message })),
);
} }
//GET parameter from API //GET parameter from API
@ -101,9 +142,7 @@ export class AppService {
const payload = { dni: paramUserDNI }; const payload = { dni: paramUserDNI };
return this.clientUserApp return this.clientUserApp
.send<string>(pattern, payload) .send<string>(pattern, payload)
.pipe( .pipe(map((message: string) => ({ message })));
map((message: string) => ({ message })),
);
} }
findGuardsCommunity(community_id: string) { findGuardsCommunity(community_id: string) {
@ -111,59 +150,63 @@ export class AppService {
const payload = { community_id: community_id }; const payload = { community_id: community_id };
return this.clientUserApp return this.clientUserApp
.send<string>(pattern, payload) .send<string>(pattern, payload)
.pipe( .pipe(map((message: string) => ({ message })));
map((message: string) => ({ message })),
);
} }
deleteAdminSystem(id: string) { deleteAdminSystem(id: string) {
const pattern = { cmd: 'deleteAdminSystem' }; const pattern = { cmd: 'deleteAdminSystem' };
const payload = { id: id }; const payload = { id: id };
return this.clientUserApp return this.clientUserApp
.send<string>(pattern, payload) .send<string>(pattern, payload)
.pipe( .pipe(map((message: string) => ({ message })));
map((message: string) => ({ message })),
);
} }
inicioSesion(pEmail: string, pPassword: string) { inicioSesion(pEmail: string, pPassword: string) {
const pattern = { cmd: 'loginUser' }; const pattern = { cmd: 'loginUser' };
const payload = { email: pEmail, password: pPassword}; const payload = { email: pEmail, password: pPassword };
return this.clientUserApp return this.clientUserApp
.send<string>(pattern, payload) .send<string>(pattern, payload)
.pipe( .pipe(map((message: string) => ({ message })));
map((message: string) => ({ message })),
);
} }
//GET parameter from API //GET parameter from API
findCommunityAdmin(community_id: string) { findCommunityAdmin(community_id: string) {
const pattern = { cmd: 'findCommunityAdmin' }; const pattern = { cmd: 'findCommunityAdmin' };
const payload = { community_id: community_id }; const payload = { community_id: community_id };
return this.clientCommunityApp return this.clientCommunityApp
.send<string>(pattern, payload) .send<string>(pattern, payload)
.pipe( .pipe(map((message: string) => ({ message })));
map((message: string) => ({ message })),
);
} }
// ====================== COMMUNITIES =============================== // ====================== COMMUNITIES ===============================
//POST parameter from API //POST parameter from API
createCommunity(name: string, province: string, canton: string, district: string createCommunity(
, num_houses: number, phone: string, status: string, date_entry: Date, houses: []) { name: string,
province: string,
canton: string,
district: string,
num_houses: number,
phone: string,
status: string,
date_entry: Date,
houses: [],
) {
const pattern = { cmd: 'createCommunity' }; const pattern = { cmd: 'createCommunity' };
const payload = { const payload = {
name: name, province: province, canton: canton, district: district, num_houses: num_houses, name: name,
phone: phone, status: status, date_entry: date_entry, houses: houses province: province,
canton: canton,
district: district,
num_houses: num_houses,
phone: phone,
status: status,
date_entry: date_entry,
houses: houses,
}; };
return this.clientCommunityApp return this.clientCommunityApp
.send<string>(pattern, payload) .send<string>(pattern, payload)
.pipe( .pipe(map((message: string) => ({ message })));
map((message: string) => ({ message })),
);
} }
allCommunities() { allCommunities() {
@ -171,9 +214,7 @@ export class AppService {
const payload = {}; const payload = {};
return this.clientCommunityApp return this.clientCommunityApp
.send<string>(pattern, payload) .send<string>(pattern, payload)
.pipe( .pipe(map((message: string) => ({ message })));
map((message: string) => ({ message })),
);
} }
//GET parameter from API //GET parameter from API
@ -182,9 +223,7 @@ export class AppService {
const payload = { id: paramCommunityId }; const payload = { id: paramCommunityId };
return this.clientCommunityApp return this.clientCommunityApp
.send<string>(pattern, payload) .send<string>(pattern, payload)
.pipe( .pipe(map((message: string) => ({ message })));
map((message: string) => ({ message })),
);
} }
findCommunityName(paramCommunityId: string) { findCommunityName(paramCommunityId: string) {
@ -192,27 +231,29 @@ export class AppService {
const payload = { id: paramCommunityId }; const payload = { id: paramCommunityId };
return this.clientCommunityApp return this.clientCommunityApp
.send<string>(pattern, payload) .send<string>(pattern, payload)
.pipe( .pipe(map((message: string) => ({ message })));
map((message: string) => ({ message })),
);
} }
// ====================== COMMON AREAS =============================== // ====================== COMMON AREAS ===============================
//POST parameter from API //POST parameter from API
createCommonArea(name: string, hourMin: string, hourMax: string, createCommonArea(
bookable: number, community_id: string) { name: string,
hourMin: string,
hourMax: string,
bookable: number,
community_id: string,
) {
const pattern = { cmd: 'createCommonArea' }; const pattern = { cmd: 'createCommonArea' };
const payload = { const payload = {
name: name, hourMin: hourMin, hourMax: hourMax, bookable: bookable, name: name,
community_id: community_id hourMin: hourMin,
hourMax: hourMax,
bookable: bookable,
community_id: community_id,
}; };
return this.clientCommonAreaApp return this.clientCommonAreaApp
.send<string>(pattern, payload) .send<string>(pattern, payload)
.pipe( .pipe(map((message: string) => ({ message })));
map((message: string) => ({ message })),
);
} }
allCommonAreas() { allCommonAreas() {
@ -220,9 +261,7 @@ export class AppService {
const payload = {}; const payload = {};
return this.clientCommonAreaApp return this.clientCommonAreaApp
.send<string>(pattern, payload) .send<string>(pattern, payload)
.pipe( .pipe(map((message: string) => ({ message })));
map((message: string) => ({ message })),
);
} }
//GET parameter from API //GET parameter from API
@ -231,28 +270,34 @@ export class AppService {
const payload = { id: paramCommonAreaId }; const payload = { id: paramCommonAreaId };
return this.clientCommonAreaApp return this.clientCommonAreaApp
.send<string>(pattern, payload) .send<string>(pattern, payload)
.pipe( .pipe(map((message: string) => ({ message })));
map((message: string) => ({ message })),
);
} }
// ====================== GUESTS =============================== // ====================== GUESTS ===============================
//POST parameter from API //POST parameter from API
createGuest(name: string, last_name: string, dni: string, number_plate: string, phone: number createGuest(
, status: string, date_entry: Date) { name: string,
last_name: string,
dni: string,
number_plate: string,
phone: number,
status: string,
date_entry: Date,
) {
const pattern = { cmd: 'createGuest' }; const pattern = { cmd: 'createGuest' };
const payload = { const payload = {
name: name, last_name: last_name, dni: dni, number_plate: number_plate, phone: phone, name: name,
status: status, date_entry: date_entry last_name: last_name,
dni: dni,
number_plate: number_plate,
phone: phone,
status: status,
date_entry: date_entry,
}; };
return this.clientGuestApp return this.clientGuestApp
.send<string>(pattern, payload) .send<string>(pattern, payload)
.pipe( .pipe(map((message: string) => ({ message })));
map((message: string) => ({ message })),
);
} }
allGuests() { allGuests() {
@ -260,9 +305,7 @@ export class AppService {
const payload = {}; const payload = {};
return this.clientGuestApp return this.clientGuestApp
.send<string>(pattern, payload) .send<string>(pattern, payload)
.pipe( .pipe(map((message: string) => ({ message })));
map((message: string) => ({ message })),
);
} }
//GET parameter from API //GET parameter from API
@ -271,26 +314,34 @@ export class AppService {
const payload = { dni: paramGuestDNI }; const payload = { dni: paramGuestDNI };
return this.clientGuestApp return this.clientGuestApp
.send<string>(pattern, payload) .send<string>(pattern, payload)
.pipe( .pipe(map((message: string) => ({ message })));
map((message: string) => ({ message })),
);
} }
// ====================== PAYMENTS =============================== // ====================== PAYMENTS ===============================
//POST parameter from API //POST parameter from API
createPayment(date_payment: Date, mount: number, description: string, period: string createPayment(
, status: string, user_id: string, communty_id: string) { date_payment: Date,
mount: number,
description: string,
period: string,
status: string,
user_id: string,
communty_id: string,
) {
const pattern = { cmd: 'createPayment' }; const pattern = { cmd: 'createPayment' };
const payload = { const payload = {
date_payment: date_payment, mount: mount, description: description, date_payment: date_payment,
period: period, status: status, user_id: user_id, communty_id: communty_id mount: mount,
description: description,
period: period,
status: status,
user_id: user_id,
communty_id: communty_id,
}; };
return this.clientPaymentApp return this.clientPaymentApp
.send<string>(pattern, payload) .send<string>(pattern, payload)
.pipe( .pipe(map((message: string) => ({ message })));
map((message: string) => ({ message })),
);
} }
allPayments() { allPayments() {
@ -298,9 +349,7 @@ export class AppService {
const payload = {}; const payload = {};
return this.clientPaymentApp return this.clientPaymentApp
.send<string>(pattern, payload) .send<string>(pattern, payload)
.pipe( .pipe(map((message: string) => ({ message })));
map((message: string) => ({ message })),
);
} }
//GET parameter from API //GET parameter from API
@ -309,27 +358,32 @@ export class AppService {
const payload = { id: paramPaymentId }; const payload = { id: paramPaymentId };
return this.clientPaymentApp return this.clientPaymentApp
.send<string>(pattern, payload) .send<string>(pattern, payload)
.pipe( .pipe(map((message: string) => ({ message })));
map((message: string) => ({ message })),
);
} }
// ====================== RESERVATIONS =============================== // ====================== RESERVATIONS ===============================
//POST parameter from API //POST parameter from API
createReservation(start_time: string, finish_time: string, status: string, createReservation(
date_entry: Date, user_id: string, common_area_id: string) { start_time: string,
finish_time: string,
status: string,
date_entry: Date,
user_id: string,
common_area_id: string,
) {
const pattern = { cmd: 'createReservation' }; const pattern = { cmd: 'createReservation' };
const payload = { const payload = {
start_time: start_time, finish_time: finish_time, status: status, start_time: start_time,
date_entry: date_entry, user_id: user_id, common_area_id: common_area_id finish_time: finish_time,
status: status,
date_entry: date_entry,
user_id: user_id,
common_area_id: common_area_id,
}; };
return this.clientReservationApp return this.clientReservationApp
.send<string>(pattern, payload) .send<string>(pattern, payload)
.pipe( .pipe(map((message: string) => ({ message })));
map((message: string) => ({ message })),
);
} }
allReservations() { allReservations() {
@ -337,9 +391,7 @@ export class AppService {
const payload = {}; const payload = {};
return this.clientReservationApp return this.clientReservationApp
.send<string>(pattern, payload) .send<string>(pattern, payload)
.pipe( .pipe(map((message: string) => ({ message })));
map((message: string) => ({ message })),
);
} }
//GET parameter from API //GET parameter from API
@ -348,27 +400,28 @@ export class AppService {
const payload = { id: paramReservationId }; const payload = { id: paramReservationId };
return this.clientReservationApp return this.clientReservationApp
.send<string>(pattern, payload) .send<string>(pattern, payload)
.pipe( .pipe(map((message: string) => ({ message })));
map((message: string) => ({ message })),
);
} }
// ====================== POSTS =============================== // ====================== POSTS ===============================
//POST parameter from API //POST parameter from API
createPost(post: string, date_entry: Date, user_id: string, createPost(
community_id: string) { post: string,
date_entry: Date,
user_id: string,
community_id: string,
) {
const pattern = { cmd: 'createPost' }; const pattern = { cmd: 'createPost' };
const payload = { const payload = {
post: post, date_entry: date_entry, user_id: user_id, post: post,
community_id: community_id date_entry: date_entry,
user_id: user_id,
community_id: community_id,
}; };
return this.clientPostApp return this.clientPostApp
.send<string>(pattern, payload) .send<string>(pattern, payload)
.pipe( .pipe(map((message: string) => ({ message })));
map((message: string) => ({ message })),
);
} }
allPosts() { allPosts() {
@ -376,9 +429,7 @@ export class AppService {
const payload = {}; const payload = {};
return this.clientPostApp return this.clientPostApp
.send<string>(pattern, payload) .send<string>(pattern, payload)
.pipe( .pipe(map((message: string) => ({ message })));
map((message: string) => ({ message })),
);
} }
//GET parameter from API //GET parameter from API
@ -387,26 +438,28 @@ export class AppService {
const payload = { id: paramPostId }; const payload = { id: paramPostId };
return this.clientPostApp return this.clientPostApp
.send<string>(pattern, payload) .send<string>(pattern, payload)
.pipe( .pipe(map((message: string) => ({ message })));
map((message: string) => ({ message })),
);
} }
// ====================== COMMNENT POSTS =============================== // ====================== COMMNENT POSTS ===============================
//Comment parameter from API //Comment parameter from API
createComment(comment: string, date_entry: Date, user_id: string, createComment(
post_id: string) { comment: string,
date_entry: Date,
user_id: string,
post_id: string,
) {
const pattern = { cmd: 'createComment' }; const pattern = { cmd: 'createComment' };
const payload = { const payload = {
comment: comment, date_entry: date_entry, user_id: user_id, comment: comment,
post_id: post_id date_entry: date_entry,
user_id: user_id,
post_id: post_id,
}; };
return this.clientPostApp return this.clientPostApp
.send<string>(pattern, payload) .send<string>(pattern, payload)
.pipe( .pipe(map((message: string) => ({ message })));
map((message: string) => ({ message })),
);
} }
allComments() { allComments() {
@ -414,9 +467,7 @@ export class AppService {
const payload = {}; const payload = {};
return this.clientPostApp return this.clientPostApp
.send<string>(pattern, payload) .send<string>(pattern, payload)
.pipe( .pipe(map((message: string) => ({ message })));
map((message: string) => ({ message })),
);
} }
//GET parameter from API //GET parameter from API
@ -425,26 +476,28 @@ export class AppService {
const payload = { id: paramCommentId }; const payload = { id: paramCommentId };
return this.clientPostApp return this.clientPostApp
.send<string>(pattern, payload) .send<string>(pattern, payload)
.pipe( .pipe(map((message: string) => ({ message })));
map((message: string) => ({ message })),
);
} }
// ====================== REPORTS =============================== // ====================== REPORTS ===============================
//Report parameter from API //Report parameter from API
createReport(action: string, description: string, date_entry: Date, createReport(
user_id: string) { action: string,
description: string,
date_entry: Date,
user_id: string,
) {
const pattern = { cmd: 'createReport' }; const pattern = { cmd: 'createReport' };
const payload = { const payload = {
action: action, description: description, date_entry: date_entry, action: action,
user_id: user_id description: description,
date_entry: date_entry,
user_id: user_id,
}; };
return this.clientReportApp return this.clientReportApp
.send<string>(pattern, payload) .send<string>(pattern, payload)
.pipe( .pipe(map((message: string) => ({ message })));
map((message: string) => ({ message })),
);
} }
allReports() { allReports() {
@ -452,9 +505,7 @@ export class AppService {
const payload = {}; const payload = {};
return this.clientReportApp return this.clientReportApp
.send<string>(pattern, payload) .send<string>(pattern, payload)
.pipe( .pipe(map((message: string) => ({ message })));
map((message: string) => ({ message })),
);
} }
//GET parameter from API //GET parameter from API
@ -463,29 +514,22 @@ export class AppService {
const payload = { id: paramReportId }; const payload = { id: paramReportId };
return this.clientReportApp return this.clientReportApp
.send<string>(pattern, payload) .send<string>(pattern, payload)
.pipe( .pipe(map((message: string) => ({ message })));
map((message: string) => ({ message })),
);
} }
sendMail(email: string) { sendMail(email: string) {
const pattern = { cmd: 'sendMail' }; const pattern = { cmd: 'sendMail' };
const payload = { email: email}; const payload = { email: email };
return this.clientNotificationtApp return this.clientNotificationtApp
.send<string>(pattern, payload) .send<string>(pattern, payload)
.pipe( .pipe(map((message: string) => ({ message })));
map((message: string) => ({ message })),
);
} }
html(email: string, name: string) { html(email: string, name: string) {
const pattern = { cmd: 'html' }; const pattern = { cmd: 'html' };
const payload = { email: email, name: name}; const payload = { email: email, name: name };
return this.clientNotificationtApp return this.clientNotificationtApp
.send<string>(pattern, payload) .send<string>(pattern, payload)
.pipe( .pipe(map((message: string) => ({ message })));
map((message: string) => ({ message })),
);
} }
} }

View File

@ -7,8 +7,8 @@
}, },
"scripts": { "scripts": {
"format": "npm run format:prettier && npm run format:html", "format": "npm run format:prettier && npm run format:html",
"format:prettier": "prettier --config .prettierrc \"src/**/*.{ts,css,less,scss,js}\" --write", "format:prettier": "prettier --config .prettierrc \"**/src/**/*.{ts,css,less,scss,js}\" --write",
"format:html": "js-beautify --config .jsbeautifyrc --type 'html' --file 'src/**/*.html' --replace" "format:html": "js-beautify --config .jsbeautifyrc --type 'html' --file '**/src/**/*.html' --replace"
}, },
"husky": { "husky": {
"hooks": { "hooks": {

View File

@ -6,7 +6,9 @@ import { BooksModule } from './books/books.module';
@Module({ @Module({
imports: [ imports: [
MongooseModule.forRoot(`mongodb+srv://proyecto_4:proyecto_4@proyecto4.yv4fb.mongodb.net/servicio_books?retryWrites=true&w=majority`), MongooseModule.forRoot(
`mongodb+srv://proyecto_4:proyecto_4@proyecto4.yv4fb.mongodb.net/servicio_books?retryWrites=true&w=majority`,
),
BooksModule, BooksModule,
], ],
controllers: [AppController], controllers: [AppController],

View File

@ -9,6 +9,6 @@ import { Book, BookSchema } from './schemas/book.schema';
MongooseModule.forFeature([{ name: Book.name, schema: BookSchema }]), MongooseModule.forFeature([{ name: Book.name, schema: BookSchema }]),
], ],
controllers: [BooksController], controllers: [BooksController],
providers: [BooksService] providers: [BooksService],
}) })
export class BooksModule {} export class BooksModule {}

View File

@ -1,7 +1,5 @@
import { ApiProperty } from '@nestjs/swagger'; import { ApiProperty } from '@nestjs/swagger';
export class CreateBookDto { export class CreateBookDto {
@ApiProperty({ @ApiProperty({
example: 'Nest.js: A Progressive Node.js Framework (English Edition)', example: 'Nest.js: A Progressive Node.js Framework (English Edition)',

View File

@ -1,23 +1,25 @@
import { Module } from '@nestjs/common'; import { Module } from '@nestjs/common';
import { CommonAreasModule } from './common_areas/common_areas.module'; import { CommonAreasModule } from './common_areas/common_areas.module';
import { MongooseModule } from '@nestjs/mongoose'; import { MongooseModule } from '@nestjs/mongoose';
import { ClientsModule, Transport } from "@nestjs/microservices"; import { ClientsModule, Transport } from '@nestjs/microservices';
@Module({ @Module({
imports: [ imports: [
ClientsModule.register([ ClientsModule.register([
{ {
name: "SERVICIO_AREAS_COMUNES", name: 'SERVICIO_AREAS_COMUNES',
transport: Transport.TCP, transport: Transport.TCP,
options: { options: {
host: "127.0.0.1", host: '127.0.0.1',
port: 3003 port: 3003,
} },
} },
]), ]),
MongooseModule.forRoot(`mongodb+srv://proyecto_4:proyecto_4@proyecto4.yv4fb.mongodb.net/servicio_areas_comunes?retryWrites=true&w=majority`), MongooseModule.forRoot(
CommonAreasModule], `mongodb+srv://proyecto_4:proyecto_4@proyecto4.yv4fb.mongodb.net/servicio_areas_comunes?retryWrites=true&w=majority`,
),
CommonAreasModule,
],
controllers: [], controllers: [],
providers: [], providers: [],
}) })

View File

@ -7,28 +7,28 @@ import { CommonAreasService } from './common_areas.service';
export class CommonAreasController { export class CommonAreasController {
constructor(private readonly commonAreasService: CommonAreasService) {} constructor(private readonly commonAreasService: CommonAreasService) {}
@MessagePattern({cmd: 'createCommonArea'}) @MessagePattern({ cmd: 'createCommonArea' })
create(@Payload() commonArea: CommonAreaDocument) { create(@Payload() commonArea: CommonAreaDocument) {
return this.commonAreasService.create(commonArea); return this.commonAreasService.create(commonArea);
} }
@MessagePattern({cmd: 'findAllCommonAreas'}) @MessagePattern({ cmd: 'findAllCommonAreas' })
findAll() { findAll() {
return this.commonAreasService.findAll(); return this.commonAreasService.findAll();
} }
@MessagePattern({cmd: 'findOneCommonArea'}) @MessagePattern({ cmd: 'findOneCommonArea' })
findOne(@Payload() id: string) { findOne(@Payload() id: string) {
let _id = id['_id']; let _id = id['_id'];
return this.commonAreasService.findOne(_id); return this.commonAreasService.findOne(_id);
} }
@MessagePattern({cmd: 'updateCommonArea'}) @MessagePattern({ cmd: 'updateCommonArea' })
update(@Payload() commonArea: CommonAreaDocument) { update(@Payload() commonArea: CommonAreaDocument) {
return this.commonAreasService.update(commonArea.id, commonArea); return this.commonAreasService.update(commonArea.id, commonArea);
} }
@MessagePattern({cmd: 'removeCommonArea'}) @MessagePattern({ cmd: 'removeCommonArea' })
remove(@Payload() id: string) { remove(@Payload() id: string) {
let _id = id['_id']; let _id = id['_id'];
return this.commonAreasService.remove(_id); return this.commonAreasService.remove(_id);

View File

@ -6,9 +6,11 @@ import { MongooseModule } from '@nestjs/mongoose';
import { CommonArea, CommonAreaSchema } from '../schemas/common_area.schema'; import { CommonArea, CommonAreaSchema } from '../schemas/common_area.schema';
@Module({ @Module({
imports: [ imports: [
MongooseModule.forFeature([{ name: CommonArea.name, schema: CommonAreaSchema }]), MongooseModule.forFeature([
{ name: CommonArea.name, schema: CommonAreaSchema },
]),
], ],
controllers: [CommonAreasController], controllers: [CommonAreasController],
providers: [CommonAreasService] providers: [CommonAreasService],
}) })
export class CommonAreasModule {} export class CommonAreasModule {}

View File

@ -5,9 +5,9 @@ import { Model } from 'mongoose';
@Injectable() @Injectable()
export class CommonAreasService { export class CommonAreasService {
constructor( constructor(
@InjectModel(CommonArea.name) private readonly commonAreaModel: Model<CommonAreaDocument>, @InjectModel(CommonArea.name)
private readonly commonAreaModel: Model<CommonAreaDocument>,
) {} ) {}
async create(commonArea: CommonAreaDocument): Promise<CommonArea> { async create(commonArea: CommonAreaDocument): Promise<CommonArea> {

View File

@ -1,7 +1,7 @@
import { NestFactory } from "@nestjs/core"; import { NestFactory } from '@nestjs/core';
import { Transport } from "@nestjs/microservices"; import { Transport } from '@nestjs/microservices';
import { AppModule } from "./app.module"; import { AppModule } from './app.module';
import { Logger } from "@nestjs/common"; import { Logger } from '@nestjs/common';
const logger = new Logger(); const logger = new Logger();
@ -9,10 +9,12 @@ async function bootstrap() {
const app = await NestFactory.createMicroservice(AppModule, { const app = await NestFactory.createMicroservice(AppModule, {
transport: Transport.TCP, transport: Transport.TCP,
options: { options: {
host: "127.0.0.1", host: '127.0.0.1',
port: 3003 port: 3003,
} },
}); });
app.listen().then(() => logger.log("Microservice Áreas Comunes is listening" )); app
.listen()
.then(() => logger.log('Microservice Áreas Comunes is listening'));
} }
bootstrap(); bootstrap();

View File

@ -1,29 +1,26 @@
import { Schema, Prop, SchemaFactory } from '@nestjs/mongoose'; import { Schema, Prop, SchemaFactory } from '@nestjs/mongoose';
import { Document } from 'mongoose'; import { Document } from 'mongoose';
import { Timestamp } from 'rxjs'; import { Timestamp } from 'rxjs';
import { TimerOptions } from 'timers'; import { TimerOptions } from 'timers';
export type CommonAreaDocument = CommonArea & Document; export type CommonAreaDocument = CommonArea & Document;
@Schema({ collection: 'common_areas' }) @Schema({ collection: 'common_areas' })
export class CommonArea { export class CommonArea {
@Prop()
name: string;
@Prop() @Prop()
name: string; hourMin: string; //hora militar, separado por dos puntos
@Prop() @Prop()
hourMin: string; //hora militar, separado por dos puntos hourMax: string; //hora militar, separado por dos puntos
@Prop() @Prop()
hourMax: string; //hora militar, separado por dos puntos bookable: number; //saber si es necesario reservarlo o no
@Prop() @Prop()
bookable: number; //saber si es necesario reservarlo o no community_id: string;
@Prop()
community_id: string;
} }
export const CommonAreaSchema = SchemaFactory.createForClass(CommonArea); export const CommonAreaSchema = SchemaFactory.createForClass(CommonArea);

View File

@ -1,24 +1,26 @@
import { Module } from '@nestjs/common'; import { Module } from '@nestjs/common';
import { CommunitiesModule } from './communities/communities.module'; import { CommunitiesModule } from './communities/communities.module';
import { MongooseModule } from '@nestjs/mongoose'; import { MongooseModule } from '@nestjs/mongoose';
import { ClientsModule, Transport } from "@nestjs/microservices"; import { ClientsModule, Transport } from '@nestjs/microservices';
@Module({ @Module({
imports: [ imports: [
ClientsModule.register([ ClientsModule.register([
{ {
name: "SERVICIO_COMUNIDADES", name: 'SERVICIO_COMUNIDADES',
transport: Transport.TCP, transport: Transport.TCP,
options: { options: {
host: "127.0.0.1", host: '127.0.0.1',
port: 3002 port: 3002,
} },
} },
]), ]),
MongooseModule.forRoot(`mongodb+srv://proyecto_4:proyecto_4@proyecto4.yv4fb.mongodb.net/servicio_comunidades?retryWrites=true&w=majority`), MongooseModule.forRoot(
CommunitiesModule], `mongodb+srv://proyecto_4:proyecto_4@proyecto4.yv4fb.mongodb.net/servicio_comunidades?retryWrites=true&w=majority`,
),
CommunitiesModule,
],
controllers: [], controllers: [],
providers: [], providers: [],
}) })
export class AppModule { } export class AppModule {}

View File

@ -12,35 +12,35 @@ export class CommunitiesController {
return this.communitiesService.create(community); return this.communitiesService.create(community);
} }
@MessagePattern({cmd: 'findAllCommunities'}) @MessagePattern({ cmd: 'findAllCommunities' })
findAll() { findAll() {
return this.communitiesService.findAll(); return this.communitiesService.findAll();
} }
@MessagePattern({cmd: 'findOneCommunity'}) @MessagePattern({ cmd: 'findOneCommunity' })
findOne(@Payload() id: string) { findOne(@Payload() id: string) {
let _id = id['_id']; let _id = id['_id'];
return this.communitiesService.findOne(_id); return this.communitiesService.findOne(_id);
} }
@MessagePattern({cmd: 'findCommunityName'}) @MessagePattern({ cmd: 'findCommunityName' })
findOneName(@Payload() id: string) { findOneName(@Payload() id: string) {
let _id = id['id']; let _id = id['id'];
return this.communitiesService.findOneName(_id); return this.communitiesService.findOneName(_id);
} }
/* @MessagePattern({cmd: 'findCommunityAdmin'}) /* @MessagePattern({cmd: 'findCommunityAdmin'})
findCommunityAdmin(@Payload() community: any) { findCommunityAdmin(@Payload() community: any) {
let _community = community['community_id']; let _community = community['community_id'];
return this.communitiesService.findCommunityAdmin(_community, "2"); return this.communitiesService.findCommunityAdmin(_community, "2");
}*/ }*/
@MessagePattern({cmd: 'updateCommunity'}) @MessagePattern({ cmd: 'updateCommunity' })
update(@Payload() community: CommunityDocument) { update(@Payload() community: CommunityDocument) {
return this.communitiesService.update(community.id, community); return this.communitiesService.update(community.id, community);
} }
@MessagePattern({cmd: 'removeCommunity'}) @MessagePattern({ cmd: 'removeCommunity' })
remove(@Payload() id: string) { remove(@Payload() id: string) {
let _id = id['_id']; let _id = id['_id'];
return this.communitiesService.remove(_id); return this.communitiesService.remove(_id);

View File

@ -2,26 +2,27 @@ import { Module } from '@nestjs/common';
import { CommunitiesService } from './communities.service'; import { CommunitiesService } from './communities.service';
import { CommunitiesController } from './communities.controller'; import { CommunitiesController } from './communities.controller';
import { MongooseModule } from '@nestjs/mongoose'; import { MongooseModule } from '@nestjs/mongoose';
import { ClientsModule, Transport } from "@nestjs/microservices"; import { ClientsModule, Transport } from '@nestjs/microservices';
import { Community, CommunitySchema } from '../schemas/community.schema'; import { Community, CommunitySchema } from '../schemas/community.schema';
@Module({ @Module({
imports: [ imports: [
ClientsModule.register([ ClientsModule.register([
{ {
name: "SERVICIO_USUARIOS", name: 'SERVICIO_USUARIOS',
transport: Transport.TCP, transport: Transport.TCP,
options: { options: {
host: "127.0.0.1", host: '127.0.0.1',
port: 3001 port: 3001,
} },
} },
]),
MongooseModule.forFeature([
{ name: Community.name, schema: CommunitySchema },
]), ]),
MongooseModule.forFeature([{ name: Community.name, schema: CommunitySchema }]),
], ],
controllers: [CommunitiesController], controllers: [CommunitiesController],
providers: [CommunitiesService] providers: [CommunitiesService],
}) })
export class CommunitiesModule {} export class CommunitiesModule {}

View File

@ -7,40 +7,39 @@ import { from, lastValueFrom, map, scan, mergeMap } from 'rxjs';
import { Admin } from 'src/schemas/admin.entity'; import { Admin } from 'src/schemas/admin.entity';
import { appendFileSync } from 'fs'; import { appendFileSync } from 'fs';
@Injectable() @Injectable()
export class CommunitiesService { export class CommunitiesService {
constructor( constructor(
@InjectModel(Community.name) private readonly communityModel: Model<CommunityDocument>, @InjectModel(Community.name)
private readonly communityModel: Model<CommunityDocument>,
@Inject('SERVICIO_USUARIOS') private readonly clientUserApp: ClientProxy, @Inject('SERVICIO_USUARIOS') private readonly clientUserApp: ClientProxy,
) {}
) { }
async create(community: CommunityDocument): Promise<Community> { async create(community: CommunityDocument): Promise<Community> {
return this.communityModel.create(community); return this.communityModel.create(community);
} }
async findAll(): Promise<Community[]> { async findAll(): Promise<Community[]> {
return await this.communityModel return await this.communityModel
.find() .find()
.setOptions({ sanitizeFilter: true }) .setOptions({ sanitizeFilter: true })
.exec() .exec()
.then(async community => { .then(async (community) => {
if (community) { if (community) {
await Promise.all(community.map(async c => { await Promise.all(
//buscar al usuario con el id de la comunidad anexado community.map(async (c) => {
let admin = await this.findCommunityAdmin(c["_id"], "2") //buscar al usuario con el id de la comunidad anexado
if (admin) { let admin = await this.findCommunityAdmin(c['_id'], '2');
c["id_admin"] = admin["_id"] if (admin) {
c["name_admin"] = admin["name"] c['id_admin'] = admin['_id'];
} c['name_admin'] = admin['name'];
return c }
})) return c;
}),
);
} }
return community; return community;
}) });
} }
findOne(id: string): Promise<Community> { findOne(id: string): Promise<Community> {
@ -61,17 +60,14 @@ export class CommunitiesService {
} }
async findCommunityAdmin(community: string, user_type: string) { async findCommunityAdmin(community: string, user_type: string) {
const pattern = { cmd: 'findOneCommunityUser' } const pattern = { cmd: 'findOneCommunityUser' };
const payload = { community_id: community, user_type: user_type } const payload = { community_id: community, user_type: user_type };
let callback = await this.clientUserApp let callback = await this.clientUserApp
.send<string>(pattern, payload) .send<string>(pattern, payload)
.pipe( .pipe(map((response: string) => ({ response })));
map((response: string) => ({ response }))
)
const finalValue = await lastValueFrom(callback); const finalValue = await lastValueFrom(callback);
return finalValue['response']; return finalValue['response'];
} }
} }

View File

@ -1,7 +1,7 @@
import { NestFactory } from "@nestjs/core"; import { NestFactory } from '@nestjs/core';
import { Transport } from "@nestjs/microservices"; import { Transport } from '@nestjs/microservices';
import { AppModule } from "./app.module"; import { AppModule } from './app.module';
import { Logger } from "@nestjs/common"; import { Logger } from '@nestjs/common';
const logger = new Logger(); const logger = new Logger();
@ -9,10 +9,14 @@ async function bootstrap() {
const app = await NestFactory.createMicroservice(AppModule, { const app = await NestFactory.createMicroservice(AppModule, {
transport: Transport.TCP, transport: Transport.TCP,
options: { options: {
host: "127.0.0.1", host: '127.0.0.1',
port: 3002 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();

View File

@ -1,4 +1,4 @@
export interface Admin { export interface Admin {
id_community: string; id_community: string;
user_type: string; user_type: string;
} }

View File

@ -2,45 +2,42 @@ import { Schema, Prop, SchemaFactory } from '@nestjs/mongoose';
import { Document } from 'mongoose'; import { Document } from 'mongoose';
import { House, HouseSchema } from './house.schema'; import { House, HouseSchema } from './house.schema';
export type CommunityDocument = Community & Document; export type CommunityDocument = Community & Document;
@Schema({ collection: 'communities' }) @Schema({ collection: 'communities' })
export class Community { export class Community {
@Prop() @Prop()
id_admin: string; id_admin: string;
@Prop() @Prop()
name_admin: string ; name_admin: string;
@Prop() @Prop()
name: string; name: string;
@Prop() @Prop()
province: string; province: string;
@Prop() @Prop()
canton: string; canton: string;
@Prop() @Prop()
district: string; district: string;
@Prop() @Prop()
num_houses: number; num_houses: number;
@Prop() @Prop()
phone: string; phone: string;
@Prop() @Prop()
status: string; status: string;
@Prop() @Prop()
date_entry: Date; date_entry: Date;
@Prop({ type: [HouseSchema] })
houses: Array<House>;
@Prop({ type: [HouseSchema] })
houses: Array<House>;
} }
export const CommunitySchema = SchemaFactory.createForClass(Community); export const CommunitySchema = SchemaFactory.createForClass(Community);

View File

@ -4,17 +4,15 @@ import { Document } from 'mongoose';
import { empty } from 'rxjs'; import { empty } from 'rxjs';
import { Tenant, TenantSchema } from './tenant.schema'; import { Tenant, TenantSchema } from './tenant.schema';
@Schema() @Schema()
export class House extends Document { export class House extends Document {
@Prop({ default: " " }) @Prop({ default: ' ' })
number_house: string; number_house: string;
@Prop({ default: "desocupada" }) @Prop({ default: 'desocupada' })
state: string; state: string;
@Prop({ type: TenantSchema }) @Prop({ type: TenantSchema })
tenants: Tenant; tenants: Tenant;
} }
export const HouseSchema = SchemaFactory.createForClass(House); export const HouseSchema = SchemaFactory.createForClass(House);

View File

@ -1,11 +1,9 @@
import { Schema, Prop, SchemaFactory } from '@nestjs/mongoose'; import { Schema, Prop, SchemaFactory } from '@nestjs/mongoose';
@Schema() @Schema()
export class Tenant { export class Tenant {
@Prop( {default: ''}) @Prop({ default: '' })
tenant_id: string; tenant_id: string;
} }
export const TenantSchema = SchemaFactory.createForClass(Tenant); export const TenantSchema = SchemaFactory.createForClass(Tenant);

View File

@ -1,23 +1,27 @@
import { Module } from '@nestjs/common'; import { Module } from '@nestjs/common';
import { MongooseModule } from '@nestjs/mongoose'; import { MongooseModule } from '@nestjs/mongoose';
import { ClientsModule, Transport } from "@nestjs/microservices"; import { ClientsModule, Transport } from '@nestjs/microservices';
import { PostsModule } from './posts/posts.module'; import { PostsModule } from './posts/posts.module';
import { PostCommentsModule } from './post-comments/post-comments.module'; import { PostCommentsModule } from './post-comments/post-comments.module';
@Module({ @Module({
imports: [ ClientsModule.register([ imports: [
{ ClientsModule.register([
name: "SERVICIO_POSTS", {
transport: Transport.TCP, name: 'SERVICIO_POSTS',
options: { transport: Transport.TCP,
host: "127.0.0.1", options: {
port: 3007 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`), ]),
MongooseModule.forRoot(
`mongodb+srv://proyecto_4:proyecto_4@proyecto4.yv4fb.mongodb.net/servicio_posts?retryWrites=true&w=majority`,
),
PostsModule, PostsModule,
PostCommentsModule], PostCommentsModule,
],
controllers: [], controllers: [],
providers: [], providers: [],
}) })

View File

@ -1,7 +1,7 @@
import { NestFactory } from "@nestjs/core"; import { NestFactory } from '@nestjs/core';
import { Transport } from "@nestjs/microservices"; import { Transport } from '@nestjs/microservices';
import { AppModule } from "./app.module"; import { AppModule } from './app.module';
import { Logger } from "@nestjs/common"; import { Logger } from '@nestjs/common';
const logger = new Logger(); const logger = new Logger();
@ -9,10 +9,10 @@ async function bootstrap() {
const app = await NestFactory.createMicroservice(AppModule, { const app = await NestFactory.createMicroservice(AppModule, {
transport: Transport.TCP, transport: Transport.TCP,
options: { options: {
host: "127.0.0.1", host: '127.0.0.1',
port: 3007 port: 3007,
} },
}); });
app.listen().then(() => logger.log("Microservice Comunicados is listening" )); app.listen().then(() => logger.log('Microservice Comunicados is listening'));
} }
bootstrap(); bootstrap();

View File

@ -3,7 +3,6 @@ import { MessagePattern, Payload } from '@nestjs/microservices';
import { PostCommentsService } from './post-comments.service'; import { PostCommentsService } from './post-comments.service';
import { Comment, CommentDocument } from '../schemas/post-comment.schema'; import { Comment, CommentDocument } from '../schemas/post-comment.schema';
@Controller() @Controller()
export class PostCommentsController { export class PostCommentsController {
constructor(private readonly postCommentsService: PostCommentsService) {} constructor(private readonly postCommentsService: PostCommentsService) {}
@ -18,7 +17,7 @@ export class PostCommentsController {
return this.postCommentsService.findAll(); return this.postCommentsService.findAll();
} }
@MessagePattern({cmd: 'findOneComment'}) @MessagePattern({ cmd: 'findOneComment' })
findOne(@Payload() id: string) { findOne(@Payload() id: string) {
let _id = id['id']; let _id = id['id'];
return this.postCommentsService.findOne(_id); return this.postCommentsService.findOne(_id);

View File

@ -9,6 +9,6 @@ import { Comment, CommentSchema } from '../schemas/post-comment.schema';
MongooseModule.forFeature([{ name: Comment.name, schema: CommentSchema }]), MongooseModule.forFeature([{ name: Comment.name, schema: CommentSchema }]),
], ],
controllers: [PostCommentsController], controllers: [PostCommentsController],
providers: [PostCommentsService] providers: [PostCommentsService],
}) })
export class PostCommentsModule {} export class PostCommentsModule {}

View File

@ -3,11 +3,11 @@ import { Comment, CommentDocument } from '../schemas/post-comment.schema';
import { Model } from 'mongoose'; import { Model } from 'mongoose';
import { InjectModel } from '@nestjs/mongoose'; import { InjectModel } from '@nestjs/mongoose';
@Injectable() @Injectable()
export class PostCommentsService { export class PostCommentsService {
constructor( constructor(
@InjectModel(Comment.name) private readonly commentModel: Model<CommentDocument>, @InjectModel(Comment.name)
private readonly commentModel: Model<CommentDocument>,
) {} ) {}
async create(comment: CommentDocument): Promise<Comment> { async create(comment: CommentDocument): Promise<Comment> {
@ -15,10 +15,7 @@ export class PostCommentsService {
} }
async findAll(): Promise<Comment[]> { async findAll(): Promise<Comment[]> {
return this.commentModel return this.commentModel.find().setOptions({ sanitizeFilter: true }).exec();
.find()
.setOptions({ sanitizeFilter: true })
.exec();
} }
async findOne(id: string): Promise<Comment> { async findOne(id: string): Promise<Comment> {

View File

@ -3,10 +3,9 @@ import { MessagePattern, Payload } from '@nestjs/microservices';
import { PostsService } from './posts.service'; import { PostsService } from './posts.service';
import { Post, PostDocument } from '../schemas/post.schema'; import { Post, PostDocument } from '../schemas/post.schema';
@Controller() @Controller()
export class PostsController { export class PostsController {
constructor(private readonly postsService: PostsService) { } constructor(private readonly postsService: PostsService) {}
@MessagePattern({ cmd: 'createPost' }) @MessagePattern({ cmd: 'createPost' })
create(@Payload() post: PostDocument) { create(@Payload() post: PostDocument) {

View File

@ -9,6 +9,6 @@ import { MongooseModule } from '@nestjs/mongoose';
MongooseModule.forFeature([{ name: Post.name, schema: PostSchema }]), MongooseModule.forFeature([{ name: Post.name, schema: PostSchema }]),
], ],
controllers: [PostsController], controllers: [PostsController],
providers: [PostsService] providers: [PostsService],
}) })
export class PostsModule {} export class PostsModule {}

View File

@ -7,17 +7,14 @@ import { InjectModel } from '@nestjs/mongoose';
export class PostsService { export class PostsService {
constructor( constructor(
@InjectModel(Post.name) private readonly postModel: Model<PostDocument>, @InjectModel(Post.name) private readonly postModel: Model<PostDocument>,
) { } ) {}
async create(post: PostDocument): Promise<Post> { async create(post: PostDocument): Promise<Post> {
return this.postModel.create(post); return this.postModel.create(post);
} }
async findAll(): Promise<Post[]> { async findAll(): Promise<Post[]> {
return this.postModel return this.postModel.find().setOptions({ sanitizeFilter: true }).exec();
.find()
.setOptions({ sanitizeFilter: true })
.exec();
} }
async findOne(id: string): Promise<Post> { async findOne(id: string): Promise<Post> {

View File

@ -1,25 +1,21 @@
import { Schema, Prop, SchemaFactory } from '@nestjs/mongoose'; import { Schema, Prop, SchemaFactory } from '@nestjs/mongoose';
import { Document, ObjectId } from 'mongoose'; import { Document, ObjectId } from 'mongoose';
export type CommentDocument = Comment & Document; export type CommentDocument = Comment & Document;
@Schema({ collection: 'comments' }) @Schema({ collection: 'comments' })
export class Comment { export class Comment {
@Prop()
comment: string;
@Prop() @Prop()
comment: string; date_entry: Date;
@Prop() @Prop()
date_entry: Date; user_id: string;
@Prop()
user_id: string
@Prop()
post_id: string;
@Prop()
post_id: string;
} }
export const CommentSchema = SchemaFactory.createForClass(Comment); export const CommentSchema = SchemaFactory.createForClass(Comment);

View File

@ -1,24 +1,21 @@
import { Schema, Prop, SchemaFactory } from '@nestjs/mongoose'; import { Schema, Prop, SchemaFactory } from '@nestjs/mongoose';
import { Document, ObjectId } from 'mongoose'; import { Document, ObjectId } from 'mongoose';
export type PostDocument = Post & Document; export type PostDocument = Post & Document;
@Schema({ collection: 'posts' }) @Schema({ collection: 'posts' })
export class Post { export class Post {
@Prop()
post: string;
@Prop() @Prop()
post: string; date_entry: Date;
@Prop() @Prop()
date_entry: Date; user_id: string;
@Prop() @Prop()
user_id: string 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);

View File

@ -1,23 +1,25 @@
import { Module } from '@nestjs/common'; import { Module } from '@nestjs/common';
import { GuestsModule } from './guests/guests.module'; import { GuestsModule } from './guests/guests.module';
import { MongooseModule } from '@nestjs/mongoose'; import { MongooseModule } from '@nestjs/mongoose';
import { ClientsModule, Transport } from "@nestjs/microservices"; import { ClientsModule, Transport } from '@nestjs/microservices';
@Module({ @Module({
imports: [ imports: [
ClientsModule.register([ ClientsModule.register([
{ {
name: "SERVICIO_INVITADOS", name: 'SERVICIO_INVITADOS',
transport: Transport.TCP, transport: Transport.TCP,
options: { options: {
host: "127.0.0.1", host: '127.0.0.1',
port: 3004 port: 3004,
} },
} },
]), ]),
MongooseModule.forRoot(`mongodb+srv://proyecto_4:proyecto_4@proyecto4.yv4fb.mongodb.net/servicio_invitados?retryWrites=true&w=majority`), MongooseModule.forRoot(
GuestsModule], `mongodb+srv://proyecto_4:proyecto_4@proyecto4.yv4fb.mongodb.net/servicio_invitados?retryWrites=true&w=majority`,
),
GuestsModule,
],
controllers: [], controllers: [],
providers: [], providers: [],
}) })

View File

@ -7,34 +7,34 @@ import { Guest, GuestDocument } from 'src/schemas/guest.schema';
export class GuestsController { export class GuestsController {
constructor(private readonly guestsService: GuestsService) {} constructor(private readonly guestsService: GuestsService) {}
@MessagePattern( {cmd:'createGuest'}) @MessagePattern({ cmd: 'createGuest' })
create(@Payload() guest: GuestDocument) { create(@Payload() guest: GuestDocument) {
return this.guestsService.create(guest); return this.guestsService.create(guest);
} }
@MessagePattern( {cmd:'findAllGuests'}) @MessagePattern({ cmd: 'findAllGuests' })
findAll() { findAll() {
return this.guestsService.findAll(); return this.guestsService.findAll();
} }
@MessagePattern( {cmd:'findOneGuest'}) @MessagePattern({ cmd: 'findOneGuest' })
findOneById(@Payload() id: string) { findOneById(@Payload() id: string) {
let _id = id['_id']; let _id = id['_id'];
return this.guestsService.findOneId(_id); return this.guestsService.findOneId(_id);
} }
@MessagePattern( {cmd:'findGuestDNI'}) @MessagePattern({ cmd: 'findGuestDNI' })
findOneByDNI(@Payload() id: string) { findOneByDNI(@Payload() id: string) {
let dni = id['dni']; let dni = id['dni'];
return this.guestsService.findOne(dni); return this.guestsService.findOne(dni);
} }
@MessagePattern( {cmd:'updateGuest'}) @MessagePattern({ cmd: 'updateGuest' })
update(@Payload() guest: GuestDocument) { update(@Payload() guest: GuestDocument) {
return this.guestsService.update(guest.id, guest); return this.guestsService.update(guest.id, guest);
} }
@MessagePattern( {cmd:'removeGuest'}) @MessagePattern({ cmd: 'removeGuest' })
remove(@Payload() id: string) { remove(@Payload() id: string) {
let dni = id['dni']; let dni = id['dni'];
return this.guestsService.remove(dni); return this.guestsService.remove(dni);

View File

@ -8,6 +8,6 @@ import { Guest, GuestSchema } from 'src/schemas/guest.schema';
MongooseModule.forFeature([{ name: Guest.name, schema: GuestSchema }]), MongooseModule.forFeature([{ name: Guest.name, schema: GuestSchema }]),
], ],
controllers: [GuestsController], controllers: [GuestsController],
providers: [GuestsService] providers: [GuestsService],
}) })
export class GuestsModule {} export class GuestsModule {}

View File

@ -14,18 +14,13 @@ export class GuestsService {
} }
async findAll(): Promise<Guest[]> { async findAll(): Promise<Guest[]> {
return this.guestModel return this.guestModel.find().setOptions({ sanitizeFilter: true }).exec();
.find()
.setOptions({ sanitizeFilter: true })
.exec();
} }
findOneId(id: string): Promise<Guest> { findOneId(id: string): Promise<Guest> {
return this.guestModel.findOne({ _id: id }).exec(); return this.guestModel.findOne({ _id: id }).exec();
} }
findOne(id: string): Promise<Guest> { findOne(id: string): Promise<Guest> {
return this.guestModel.findOne({ dni: id }).exec(); return this.guestModel.findOne({ dni: id }).exec();
} }

View File

@ -1,7 +1,7 @@
import { NestFactory } from "@nestjs/core"; import { NestFactory } from '@nestjs/core';
import { Transport } from "@nestjs/microservices"; import { Transport } from '@nestjs/microservices';
import { AppModule } from "./app.module"; import { AppModule } from './app.module';
import { Logger } from "@nestjs/common"; import { Logger } from '@nestjs/common';
const logger = new Logger(); const logger = new Logger();
@ -9,10 +9,10 @@ async function bootstrap() {
const app = await NestFactory.createMicroservice(AppModule, { const app = await NestFactory.createMicroservice(AppModule, {
transport: Transport.TCP, transport: Transport.TCP,
options: { options: {
host: "127.0.0.1", host: '127.0.0.1',
port: 3004 port: 3004,
} },
}); });
app.listen().then(() => logger.log("Microservice Invitados is listening" )); app.listen().then(() => logger.log('Microservice Invitados is listening'));
} }
bootstrap(); bootstrap();

View File

@ -1,40 +1,37 @@
import { Schema, Prop, SchemaFactory } from '@nestjs/mongoose'; import { Schema, Prop, SchemaFactory } from '@nestjs/mongoose';
import { Document } from 'mongoose'; import { Document } from 'mongoose';
export type GuestDocument = Guest & Document; export type GuestDocument = Guest & Document;
@Schema({ collection: 'guests' }) @Schema({ collection: 'guests' })
export class Guest { export class Guest {
@Prop()
name: string;
@Prop() @Prop()
name: string; last_name: string;
@Prop() @Prop()
last_name: string; dni: string;
@Prop() @Prop()
dni: string; phone: number;
@Prop() @Prop()
phone: number; number_plate: string;
@Prop() @Prop()
number_plate: string; status: string;
@Prop() @Prop()
status: string; date_entry: Date;
@Prop() @Prop()
date_entry: Date; tenant_id: string;
@Prop() @Prop()
tenant_id: string; 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);

View File

@ -6,6 +6,6 @@ export class AppController {
@Get() @Get()
getHello(): string { getHello(): string {
return "hola"; return 'hola';
} }
} }

View File

@ -1,14 +1,13 @@
import { Module } from '@nestjs/common'; import { Module } from '@nestjs/common';
import { AppController } from './app.controller'; import { AppController } from './app.controller';
import { MailerModule } from '@nestjs-modules/mailer'; 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 { AuthModule } from './auth/auth.module';
import { EmailController } from './email.controller'; import { EmailController } from './email.controller';
import { join } from 'path'; import { join } from 'path';
import { HandlebarsAdapter } from '@nestjs-modules/mailer/dist/adapters/handlebars.adapter'; import { HandlebarsAdapter } from '@nestjs-modules/mailer/dist/adapters/handlebars.adapter';
import { ConfigModule, ConfigService } from '@nestjs/config'; import { ConfigModule, ConfigService } from '@nestjs/config';
@Module({ @Module({
imports: [ imports: [
MailerModule.forRootAsync({ MailerModule.forRootAsync({
@ -42,15 +41,16 @@ import { ConfigModule, ConfigService } from '@nestjs/config';
}), }),
ClientsModule.register([ ClientsModule.register([
{ {
name: "SERVICIO_NOTIFICACIONES", name: 'SERVICIO_NOTIFICACIONES',
transport: Transport.TCP, transport: Transport.TCP,
options: { options: {
host: "127.0.0.1", host: '127.0.0.1',
port: 3009 port: 3009,
} },
} },
]), ]),
AuthModule], AuthModule,
],
controllers: [AppController, EmailController], controllers: [AppController, EmailController],
providers: [], providers: [],
}) })

View File

@ -3,7 +3,6 @@ import { User } from './../user/user.entity';
@Injectable() @Injectable()
export class AuthService { export class AuthService {
async signUp(user: User) { async signUp(user: User) {
const token = Math.floor(1000 + Math.random() * 9000).toString(); const token = Math.floor(1000 + Math.random() * 9000).toString();
// create user in db // create user in db

View File

@ -6,41 +6,40 @@ import { User } from './user/user.entity';
@Controller() @Controller()
export class EmailController { export class EmailController {
constructor(private mailService: MailerService) { } constructor(private mailService: MailerService) {}
@MessagePattern({ cmd: 'sendMail' }) @MessagePattern({ cmd: 'sendMail' })
sendMail(@Payload() toEmail: string) { 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;
}
var response = this.mailService.sendMail({ @MessagePattern({ cmd: 'html' })
to: toEmail["email"], async postHTMLEmail(@Payload() user: any) {
from: "mbonilla.guti@gmail.com", const url = 'http://localhost:3000/';
subject: 'Plain Text Email ✔', const image = 'images/email.ong';
text: 'Welcome NestJS Email Sending Tutorial', var response = await this.mailService.sendMail({
}); to: user['email'],
return response; from: 'mbonilla.guti@gmail.com',
} subject: 'HTML Dynamic Template',
template: 'templateEmail',
@MessagePattern({ cmd: 'html' }) context: {
async postHTMLEmail(@Payload() user: any) { name: user['name'],
const url = "http://localhost:3000/"; url,
const image = "images/email.ong"; },
var response = await this.mailService.sendMail({ attachments: [
to: user["email"], {
from: "mbonilla.guti@gmail.com", filename: 'email.png',
subject: 'HTML Dynamic Template', path: __dirname + '/mails/images/email.png',
template: 'templateEmail', cid: 'logo', //my mistake was putting "cid:logo@cid" here!
context: { },
name: user["name"], ],
url });
}, return response;
attachments: [ }
{
filename: 'email.png',
path: __dirname +'/mails/images/email.png',
cid: 'logo' //my mistake was putting "cid:logo@cid" here!
}
]
});
return response;
}
} }

View File

@ -1,7 +1,7 @@
import { NestFactory } from "@nestjs/core"; import { NestFactory } from '@nestjs/core';
import { Transport } from "@nestjs/microservices"; import { Transport } from '@nestjs/microservices';
import { AppModule } from "./app.module"; import { AppModule } from './app.module';
import { Logger } from "@nestjs/common"; import { Logger } from '@nestjs/common';
const logger = new Logger(); const logger = new Logger();
@ -9,10 +9,12 @@ async function bootstrap() {
const app = await NestFactory.createMicroservice(AppModule, { const app = await NestFactory.createMicroservice(AppModule, {
transport: Transport.TCP, transport: Transport.TCP,
options: { options: {
host: "127.0.0.1", host: '127.0.0.1',
port: 3009 port: 3009,
} },
}); });
app.listen().then(() => logger.log("Microservice Notificaciones is listening" )); app
.listen()
.then(() => logger.log('Microservice Notificaciones is listening'));
} }
bootstrap(); bootstrap();

View File

@ -8,27 +8,30 @@ import { UpdateNotificationDto } from './dto/update-notification.dto';
export class NotificationsController { export class NotificationsController {
constructor(private readonly notificationsService: NotificationsService) {} constructor(private readonly notificationsService: NotificationsService) {}
@MessagePattern({cmd: 'createNotification'}) @MessagePattern({ cmd: 'createNotification' })
create(@Payload() createNotificationDto: CreateNotificationDto) { create(@Payload() createNotificationDto: CreateNotificationDto) {
return this.notificationsService.create(createNotificationDto); return this.notificationsService.create(createNotificationDto);
} }
@MessagePattern({cmd: 'findAllNotifications'}) @MessagePattern({ cmd: 'findAllNotifications' })
findAll() { findAll() {
return this.notificationsService.findAll(); return this.notificationsService.findAll();
} }
@MessagePattern({cmd: 'findOneNotification'}) @MessagePattern({ cmd: 'findOneNotification' })
findOne(@Payload() id: number) { findOne(@Payload() id: number) {
return this.notificationsService.findOne(id); return this.notificationsService.findOne(id);
} }
@MessagePattern({cmd: 'updateNotification'}) @MessagePattern({ cmd: 'updateNotification' })
update(@Payload() updateNotificationDto: UpdateNotificationDto) { 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) { remove(@Payload() id: number) {
return this.notificationsService.remove(id); return this.notificationsService.remove(id);
} }

View File

@ -4,6 +4,6 @@ import { NotificationsController } from './notifications.controller';
@Module({ @Module({
controllers: [NotificationsController], controllers: [NotificationsController],
providers: [NotificationsService] providers: [NotificationsService],
}) })
export class NotificationsModule {} export class NotificationsModule {}

View File

@ -1,4 +1,4 @@
export interface User { export interface User {
email: string; email: string;
name: string; name: string;
} }

View File

@ -1,23 +1,25 @@
import { Module } from '@nestjs/common'; import { Module } from '@nestjs/common';
import { PaymentsModule } from './payments/payments.module'; import { PaymentsModule } from './payments/payments.module';
import { MongooseModule } from '@nestjs/mongoose'; import { MongooseModule } from '@nestjs/mongoose';
import { ClientsModule, Transport } from "@nestjs/microservices"; import { ClientsModule, Transport } from '@nestjs/microservices';
@Module({ @Module({
imports: [ imports: [
ClientsModule.register([ ClientsModule.register([
{ {
name: "SERVICIO_PAGOS", name: 'SERVICIO_PAGOS',
transport: Transport.TCP, transport: Transport.TCP,
options: { options: {
host: "127.0.0.1", host: '127.0.0.1',
port: 3005 port: 3005,
} },
} },
]), ]),
MongooseModule.forRoot(`mongodb+srv://proyecto_4:proyecto_4@proyecto4.yv4fb.mongodb.net/servicio_pagos?retryWrites=true&w=majority`), MongooseModule.forRoot(
PaymentsModule], `mongodb+srv://proyecto_4:proyecto_4@proyecto4.yv4fb.mongodb.net/servicio_pagos?retryWrites=true&w=majority`,
),
PaymentsModule,
],
controllers: [], controllers: [],
providers: [], providers: [],
}) })

View File

@ -1,7 +1,7 @@
import { NestFactory } from "@nestjs/core"; import { NestFactory } from '@nestjs/core';
import { Transport } from "@nestjs/microservices"; import { Transport } from '@nestjs/microservices';
import { AppModule } from "./app.module"; import { AppModule } from './app.module';
import { Logger } from "@nestjs/common"; import { Logger } from '@nestjs/common';
const logger = new Logger(); const logger = new Logger();
@ -9,10 +9,10 @@ async function bootstrap() {
const app = await NestFactory.createMicroservice(AppModule, { const app = await NestFactory.createMicroservice(AppModule, {
transport: Transport.TCP, transport: Transport.TCP,
options: { options: {
host: "127.0.0.1", host: '127.0.0.1',
port: 3005 port: 3005,
} },
}); });
app.listen().then(() => logger.log("Microservice Invitados is listening" )); app.listen().then(() => logger.log('Microservice Invitados is listening'));
} }
bootstrap(); bootstrap();

View File

@ -7,40 +7,40 @@ import { Payment, PaymentDocument } from 'src/schemas/payment.schema';
export class PaymentsController { export class PaymentsController {
constructor(private readonly paymentsService: PaymentsService) {} constructor(private readonly paymentsService: PaymentsService) {}
@MessagePattern({cmd: 'createPayment'}) @MessagePattern({ cmd: 'createPayment' })
create(@Payload() payment: PaymentDocument) { create(@Payload() payment: PaymentDocument) {
return this.paymentsService.create(payment); return this.paymentsService.create(payment);
} }
@MessagePattern({cmd: 'findAllPayments'}) @MessagePattern({ cmd: 'findAllPayments' })
findAll() { findAll() {
return this.paymentsService.findAll(); return this.paymentsService.findAll();
} }
@MessagePattern({cmd: 'findOnePayment'}) @MessagePattern({ cmd: 'findOnePayment' })
findOne(@Payload() id: string) { findOne(@Payload() id: string) {
let _id = id['_id']; let _id = id['_id'];
return this.paymentsService.findOneId(_id); return this.paymentsService.findOneId(_id);
} }
@MessagePattern({cmd: 'findPaymentsByUser'}) @MessagePattern({ cmd: 'findPaymentsByUser' })
findByUser(@Payload() id: string) { findByUser(@Payload() id: string) {
let user_id = id['user_id']; let user_id = id['user_id'];
return this.paymentsService.findByUser(user_id); return this.paymentsService.findByUser(user_id);
} }
@MessagePattern({cmd: 'findPaymentsByCommunity'}) @MessagePattern({ cmd: 'findPaymentsByCommunity' })
findByCommunity(@Payload() id: string) { findByCommunity(@Payload() id: string) {
let community_id = id['community_id']; let community_id = id['community_id'];
return this.paymentsService.findByUser(community_id); return this.paymentsService.findByUser(community_id);
} }
@MessagePattern({cmd: 'updatePayment'}) @MessagePattern({ cmd: 'updatePayment' })
update(@Payload() payment: PaymentDocument) { update(@Payload() payment: PaymentDocument) {
return this.paymentsService.update(payment.id, payment); return this.paymentsService.update(payment.id, payment);
} }
@MessagePattern({cmd: 'removePayment'}) @MessagePattern({ cmd: 'removePayment' })
remove(@Payload() id: string) { remove(@Payload() id: string) {
let _id = id['_id']; let _id = id['_id'];
return this.paymentsService.remove(_id); return this.paymentsService.remove(_id);

View File

@ -4,12 +4,11 @@ import { PaymentsController } from './payments.controller';
import { MongooseModule } from '@nestjs/mongoose'; import { MongooseModule } from '@nestjs/mongoose';
import { Payment, PaymentSchema } from 'src/schemas/payment.schema'; import { Payment, PaymentSchema } from 'src/schemas/payment.schema';
@Module({ @Module({
imports: [ imports: [
MongooseModule.forFeature([{ name: Payment.name, schema: PaymentSchema }]), MongooseModule.forFeature([{ name: Payment.name, schema: PaymentSchema }]),
], ],
controllers: [PaymentsController], controllers: [PaymentsController],
providers: [PaymentsService] providers: [PaymentsService],
}) })
export class PaymentsModule {} export class PaymentsModule {}

View File

@ -3,11 +3,11 @@ import { Payment, PaymentDocument } from 'src/schemas/payment.schema';
import { Model } from 'mongoose'; import { Model } from 'mongoose';
import { InjectModel } from '@nestjs/mongoose'; import { InjectModel } from '@nestjs/mongoose';
@Injectable() @Injectable()
export class PaymentsService { export class PaymentsService {
constructor( constructor(
@InjectModel(Payment.name) private readonly paymentModel: Model<PaymentDocument>, @InjectModel(Payment.name)
private readonly paymentModel: Model<PaymentDocument>,
) {} ) {}
async create(payment: PaymentDocument): Promise<Payment> { async create(payment: PaymentDocument): Promise<Payment> {
@ -15,18 +15,13 @@ export class PaymentsService {
} }
async findAll(): Promise<Payment[]> { async findAll(): Promise<Payment[]> {
return this.paymentModel return this.paymentModel.find().setOptions({ sanitizeFilter: true }).exec();
.find()
.setOptions({ sanitizeFilter: true })
.exec();
} }
findOneId(id: string): Promise<Payment> { findOneId(id: string): Promise<Payment> {
return this.paymentModel.findOne({ _id: id }).exec(); return this.paymentModel.findOne({ _id: id }).exec();
} }
findByUser(id: string): Promise<Payment> { findByUser(id: string): Promise<Payment> {
return this.paymentModel.findOne({ user_id: id }).exec(); return this.paymentModel.findOne({ user_id: id }).exec();
} }

View File

@ -1,33 +1,30 @@
import { Schema, Prop, SchemaFactory } from '@nestjs/mongoose'; import { Schema, Prop, SchemaFactory } from '@nestjs/mongoose';
import { Document } from 'mongoose'; import { Document } from 'mongoose';
export type PaymentDocument = Payment & Document; export type PaymentDocument = Payment & Document;
@Schema({ collection: 'payments' }) @Schema({ collection: 'payments' })
export class Payment { export class Payment {
@Prop()
date_payment: Date;
@Prop() @Prop()
date_payment: Date; mount: number;
@Prop() @Prop()
mount: number; description: string;
@Prop() @Prop()
description: string; period: string;
@Prop() @Prop()
period: string; status: string;
@Prop() @Prop()
status: string; user_id: string;
@Prop() @Prop()
user_id: string; communty_id: string;
@Prop()
communty_id: string;
} }
export const PaymentSchema = SchemaFactory.createForClass(Payment); export const PaymentSchema = SchemaFactory.createForClass(Payment);

View File

@ -1,25 +1,26 @@
import { Module } from '@nestjs/common'; import { Module } from '@nestjs/common';
import { ReportsModule } from './reports/reports.module'; import { ReportsModule } from './reports/reports.module';
import { MongooseModule } from '@nestjs/mongoose'; import { MongooseModule } from '@nestjs/mongoose';
import { ClientsModule, Transport } from "@nestjs/microservices"; import { ClientsModule, Transport } from '@nestjs/microservices';
@Module({ @Module({
imports: [ imports: [
ClientsModule.register([ ClientsModule.register([
{ {
name: "SERVICIO_REPORTES", name: 'SERVICIO_REPORTES',
transport: Transport.TCP, transport: Transport.TCP,
options: { options: {
host: "127.0.0.1", host: '127.0.0.1',
port: 3008 port: 3008,
} },
} },
]), ]),
MongooseModule.forRoot(`mongodb+srv://proyecto_4:proyecto_4@proyecto4.yv4fb.mongodb.net/servicio_reportes?retryWrites=true&w=majority`), MongooseModule.forRoot(
ReportsModule], `mongodb+srv://proyecto_4:proyecto_4@proyecto4.yv4fb.mongodb.net/servicio_reportes?retryWrites=true&w=majority`,
),
ReportsModule,
],
controllers: [], controllers: [],
providers: [], providers: [],
}) })
export class AppModule { } export class AppModule {}

View File

@ -1,7 +1,7 @@
import { NestFactory } from "@nestjs/core"; import { NestFactory } from '@nestjs/core';
import { Transport } from "@nestjs/microservices"; import { Transport } from '@nestjs/microservices';
import { AppModule } from "./app.module"; import { AppModule } from './app.module';
import { Logger } from "@nestjs/common"; import { Logger } from '@nestjs/common';
const logger = new Logger(); const logger = new Logger();
@ -9,10 +9,10 @@ async function bootstrap() {
const app = await NestFactory.createMicroservice(AppModule, { const app = await NestFactory.createMicroservice(AppModule, {
transport: Transport.TCP, transport: Transport.TCP,
options: { options: {
host: "127.0.0.1", host: '127.0.0.1',
port: 3008 port: 3008,
} },
}); });
app.listen().then(() => logger.log("Microservice Reportes is listening" )); app.listen().then(() => logger.log('Microservice Reportes is listening'));
} }
bootstrap(); bootstrap();

View File

@ -7,7 +7,6 @@ import { Report, ReportDocument } from '../schemas/report.schema';
export class ReportsController { export class ReportsController {
constructor(private readonly reportsService: ReportsService) {} constructor(private readonly reportsService: ReportsService) {}
@MessagePattern({ cmd: 'createReport' }) @MessagePattern({ cmd: 'createReport' })
create(@Payload() report: ReportDocument) { create(@Payload() report: ReportDocument) {
return this.reportsService.create(report); return this.reportsService.create(report);

View File

@ -6,9 +6,9 @@ import { Report, ReportSchema } from '../schemas/report.schema';
@Module({ @Module({
imports: [ imports: [
MongooseModule.forFeature([{ name: Report.name, schema:ReportSchema }]), MongooseModule.forFeature([{ name: Report.name, schema: ReportSchema }]),
], ],
controllers: [ReportsController], controllers: [ReportsController],
providers: [ReportsService] providers: [ReportsService],
}) })
export class ReportsModule {} export class ReportsModule {}

View File

@ -1,34 +1,30 @@
import { Injectable, Inject } from '@nestjs/common'; import { Injectable, Inject } from '@nestjs/common';
import { ClientProxy } from "@nestjs/microservices"; import { ClientProxy } from '@nestjs/microservices';
import { Model } from 'mongoose'; import { Model } from 'mongoose';
import { InjectModel } from '@nestjs/mongoose'; import { InjectModel } from '@nestjs/mongoose';
import { Report, ReportDocument } from '../schemas/report.schema'; import { Report, ReportDocument } from '../schemas/report.schema';
import { map } from "rxjs/operators"; import { map } from 'rxjs/operators';
@Injectable() @Injectable()
export class ReportsService { export class ReportsService {
constructor( constructor(
@InjectModel(Report.name) private readonly reportModel: Model<ReportDocument>, @InjectModel(Report.name)
private readonly reportModel: Model<ReportDocument>,
// ) //
) { } {}
async create(report: ReportDocument): Promise<Report> { async create(report: ReportDocument): Promise<Report> {
return this.reportModel.create(report); return this.reportModel.create(report);
} }
async findAll(): Promise<Report[]> { async findAll(): Promise<Report[]> {
return this.reportModel return this.reportModel.find().setOptions({ sanitizeFilter: true }).exec();
.find()
.setOptions({ sanitizeFilter: true })
.exec();
} }
async findOne(id: string): Promise<Report> { async findOne(id: string): Promise<Report> {
return this.reportModel.findOne({ _id: id }).exec(); return this.reportModel.findOne({ _id: id }).exec();
} }
async update(id: string, report: ReportDocument) { async update(id: string, report: ReportDocument) {
return this.reportModel.findOneAndUpdate({ _id: id }, report, { return this.reportModel.findOneAndUpdate({ _id: id }, report, {
new: true, new: true,

View File

@ -1,24 +1,21 @@
import { Schema, Prop, SchemaFactory } from '@nestjs/mongoose'; import { Schema, Prop, SchemaFactory } from '@nestjs/mongoose';
import { Document, ObjectId } from 'mongoose'; import { Document, ObjectId } from 'mongoose';
export type ReportDocument = Report & Document; export type ReportDocument = Report & Document;
@Schema({ collection: 'reports' }) @Schema({ collection: 'reports' })
export class Report { export class Report {
@Prop()
action: string;
@Prop() @Prop()
action: string; description: string;
@Prop() @Prop()
description: string; date_entry: Date;
@Prop() @Prop()
date_entry: Date; user_id: string;
@Prop()
user_id: string
} }
export const ReportSchema = SchemaFactory.createForClass(Report); export const ReportSchema = SchemaFactory.createForClass(Report);

View File

@ -1,22 +1,25 @@
import { Module } from '@nestjs/common'; import { Module } from '@nestjs/common';
import { ReservationsModule } from './reservations/reservations.module'; import { ReservationsModule } from './reservations/reservations.module';
import { ClientsModule, Transport } from "@nestjs/microservices"; import { ClientsModule, Transport } from '@nestjs/microservices';
import { MongooseModule } from '@nestjs/mongoose'; import { MongooseModule } from '@nestjs/mongoose';
@Module({ @Module({
imports: [ imports: [
ClientsModule.register([ ClientsModule.register([
{ {
name: "SERVICIO_RESERVACIONES", name: 'SERVICIO_RESERVACIONES',
transport: Transport.TCP, transport: Transport.TCP,
options: { options: {
host: "127.0.0.1", host: '127.0.0.1',
port: 3006 port: 3006,
} },
} },
]), ]),
MongooseModule.forRoot(`mongodb+srv://proyecto_4:proyecto_4@proyecto4.yv4fb.mongodb.net/servicio_reservaciones?retryWrites=true&w=majority`), MongooseModule.forRoot(
ReservationsModule], `mongodb+srv://proyecto_4:proyecto_4@proyecto4.yv4fb.mongodb.net/servicio_reservaciones?retryWrites=true&w=majority`,
),
ReservationsModule,
],
controllers: [], controllers: [],
providers: [], providers: [],
}) })

View File

@ -1,7 +1,7 @@
import { NestFactory } from "@nestjs/core"; import { NestFactory } from '@nestjs/core';
import { Transport } from "@nestjs/microservices"; import { Transport } from '@nestjs/microservices';
import { AppModule } from "./app.module"; import { AppModule } from './app.module';
import { Logger } from "@nestjs/common"; import { Logger } from '@nestjs/common';
const logger = new Logger(); const logger = new Logger();
@ -9,10 +9,12 @@ async function bootstrap() {
const app = await NestFactory.createMicroservice(AppModule, { const app = await NestFactory.createMicroservice(AppModule, {
transport: Transport.TCP, transport: Transport.TCP,
options: { options: {
host: "127.0.0.1", host: '127.0.0.1',
port: 3006 port: 3006,
} },
}); });
app.listen().then(() => logger.log("Microservice Reservaciones is listening" )); app
.listen()
.then(() => logger.log('Microservice Reservaciones is listening'));
} }
bootstrap(); bootstrap();

View File

@ -1,11 +1,14 @@
import { Controller } from '@nestjs/common'; import { Controller } from '@nestjs/common';
import { MessagePattern, Payload } from '@nestjs/microservices'; import { MessagePattern, Payload } from '@nestjs/microservices';
import { ReservationsService } from './reservations.service'; import { ReservationsService } from './reservations.service';
import { Reservation, ReservationDocument } from '../schemas/reservation.schema'; import {
Reservation,
ReservationDocument,
} from '../schemas/reservation.schema';
@Controller() @Controller()
export class ReservationsController { export class ReservationsController {
constructor(private readonly reservationsService: ReservationsService) { } constructor(private readonly reservationsService: ReservationsService) {}
@MessagePattern({ cmd: 'createReservation' }) @MessagePattern({ cmd: 'createReservation' })
create(@Payload() reservation: ReservationDocument) { create(@Payload() reservation: ReservationDocument) {

View File

@ -3,13 +3,15 @@ import { ReservationsService } from './reservations.service';
import { MongooseModule } from '@nestjs/mongoose'; import { MongooseModule } from '@nestjs/mongoose';
import { ReservationsController } from './reservations.controller'; import { ReservationsController } from './reservations.controller';
import { Reservation, ReservationSchema} from '../schemas/reservation.schema'; import { Reservation, ReservationSchema } from '../schemas/reservation.schema';
@Module({ @Module({
imports: [ imports: [
MongooseModule.forFeature([{ name: Reservation.name, schema: ReservationSchema }]), MongooseModule.forFeature([
{ name: Reservation.name, schema: ReservationSchema },
]),
], ],
controllers: [ReservationsController], controllers: [ReservationsController],
providers: [ReservationsService] providers: [ReservationsService],
}) })
export class ReservationsModule {} export class ReservationsModule {}

View File

@ -1,12 +1,16 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { Reservation, ReservationDocument} from '../schemas/reservation.schema'; import {
Reservation,
ReservationDocument,
} from '../schemas/reservation.schema';
import { Model } from 'mongoose'; import { Model } from 'mongoose';
import { InjectModel } from '@nestjs/mongoose'; import { InjectModel } from '@nestjs/mongoose';
@Injectable() @Injectable()
export class ReservationsService { export class ReservationsService {
constructor( constructor(
@InjectModel(Reservation.name) private readonly reservationModel: Model<ReservationDocument>, @InjectModel(Reservation.name)
private readonly reservationModel: Model<ReservationDocument>,
) {} ) {}
create(reservation: ReservationDocument) { create(reservation: ReservationDocument) {

View File

@ -1,30 +1,27 @@
import { Schema, Prop, SchemaFactory } from '@nestjs/mongoose'; import { Schema, Prop, SchemaFactory } from '@nestjs/mongoose';
import { Document, ObjectId } from 'mongoose'; import { Document, ObjectId } from 'mongoose';
export type ReservationDocument = Reservation & Document; export type ReservationDocument = Reservation & Document;
@Schema({ collection: 'reservations' }) @Schema({ collection: 'reservations' })
export class Reservation { export class Reservation {
@Prop()
start_time: string;
@Prop() @Prop()
start_time: string; finish_time: string;
@Prop() @Prop()
finish_time: string; status: string;
@Prop() @Prop()
status: string; date_entry: Date;
@Prop() @Prop()
date_entry: Date; common_area_id: string;
@Prop() @Prop()
common_area_id: string; user_id: string;
@Prop()
user_id: string
} }
export const ReservationSchema = SchemaFactory.createForClass(Reservation); export const ReservationSchema = SchemaFactory.createForClass(Reservation);

View File

@ -1,22 +1,25 @@
import { Module } from '@nestjs/common'; import { Module } from '@nestjs/common';
import { MongooseModule } from '@nestjs/mongoose'; import { MongooseModule } from '@nestjs/mongoose';
import { ClientsModule, Transport } from "@nestjs/microservices"; import { ClientsModule, Transport } from '@nestjs/microservices';
import { UsersModule } from './users/users.module'; import { UsersModule } from './users/users.module';
@Module({ @Module({
imports: [ imports: [
ClientsModule.register([ ClientsModule.register([
{ {
name: "SERVICIO_USUARIOS", name: 'SERVICIO_USUARIOS',
transport: Transport.TCP, transport: Transport.TCP,
options: { options: {
host: "127.0.0.1", host: '127.0.0.1',
port: 3001 port: 3001,
} },
} },
]), ]),
MongooseModule.forRoot(`mongodb+srv://proyecto_4:proyecto_4@proyecto4.yv4fb.mongodb.net/servicio_usuarios?retryWrites=true&w=majority`), MongooseModule.forRoot(
UsersModule], `mongodb+srv://proyecto_4:proyecto_4@proyecto4.yv4fb.mongodb.net/servicio_usuarios?retryWrites=true&w=majority`,
),
UsersModule,
],
controllers: [], controllers: [],
providers: [], providers: [],
}) })

View File

@ -1,7 +1,7 @@
import { NestFactory } from "@nestjs/core"; import { NestFactory } from '@nestjs/core';
import { Transport } from "@nestjs/microservices"; import { Transport } from '@nestjs/microservices';
import { AppModule } from "./app.module"; import { AppModule } from './app.module';
import { Logger } from "@nestjs/common"; import { Logger } from '@nestjs/common';
const logger = new Logger(); const logger = new Logger();
@ -9,10 +9,10 @@ async function bootstrap() {
const app = await NestFactory.createMicroservice(AppModule, { const app = await NestFactory.createMicroservice(AppModule, {
transport: Transport.TCP, transport: Transport.TCP,
options: { options: {
host: "127.0.0.1", host: '127.0.0.1',
port: 3001 port: 3001,
} },
}); });
app.listen().then(() => logger.log("Microservice Usuarios is listening" )); app.listen().then(() => logger.log('Microservice Usuarios is listening'));
} }
bootstrap(); bootstrap();

View File

@ -1,46 +1,39 @@
import { Schema, Prop, SchemaFactory } from '@nestjs/mongoose'; import { Schema, Prop, SchemaFactory } from '@nestjs/mongoose';
import { Document } from 'mongoose'; import { Document } from 'mongoose';
export type UserDocument = User & Document; export type UserDocument = User & Document;
@Schema({ collection: 'users' }) @Schema({ collection: 'users' })
export class User { export class User {
@Prop()
dni: string;
@Prop() @Prop()
dni: string; name: string;
@Prop() @Prop()
name: string; last_name: string;
@Prop() @Prop()
last_name: string; email: string;
@Prop() @Prop()
email: string; phone: number;
@Prop() @Prop()
phone: number; password: string;
@Prop() @Prop()
password: string; user_type: string;
@Prop() @Prop()
user_type: string; status: string;
@Prop() @Prop()
status: string; date_entry: Date;
@Prop() @Prop()
date_entry: Date; community_id?: string;
@Prop()
community_id?: string;
} }
export const UserSchema = SchemaFactory.createForClass(User); export const UserSchema = SchemaFactory.createForClass(User);

View File

@ -5,7 +5,7 @@ import { UsersService } from './users.service';
@Controller() @Controller()
export class UsersController { export class UsersController {
constructor(private readonly userService: UsersService) { } constructor(private readonly userService: UsersService) {}
@MessagePattern({ cmd: 'createUser' }) @MessagePattern({ cmd: 'createUser' })
create(@Payload() user: UserDocument) { create(@Payload() user: UserDocument) {
@ -22,7 +22,6 @@ export class UsersController {
return this.userService.create(user); return this.userService.create(user);
} }
@MessagePattern({ cmd: 'findAllUsers' }) @MessagePattern({ cmd: 'findAllUsers' })
findAll() { findAll() {
return this.userService.findAll(); return this.userService.findAll();
@ -40,7 +39,6 @@ export class UsersController {
return this.userService.findGuardsCommunity(pcommunity_id); return this.userService.findGuardsCommunity(pcommunity_id);
} }
@MessagePattern({ cmd: 'updateUser' }) @MessagePattern({ cmd: 'updateUser' })
update(@Payload() user: UserDocument) { update(@Payload() user: UserDocument) {
return this.userService.update(user.id, user); return this.userService.update(user.id, user);
@ -81,15 +79,16 @@ export class UsersController {
//buscar usuario de una comunidad //buscar usuario de una comunidad
@MessagePattern({ cmd: 'findOneCommunityUser' }) @MessagePattern({ cmd: 'findOneCommunityUser' })
findCommunityUser(@Payload() user: any) { 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' }) @MessagePattern({ cmd: 'deleteAdminSystem' })
deleteAdminSystem(@Payload() user: any) { deleteAdminSystem(@Payload() user: any) {
console.log("entró") console.log('entró');
return this.userService.deleteAdminSystem(user["id"]); return this.userService.deleteAdminSystem(user['id']);
} }
} }

View File

@ -4,23 +4,23 @@ import { MongooseModule } from '@nestjs/mongoose';
import { UsersController } from './users.controller'; import { UsersController } from './users.controller';
import { User, UserSchema } from '../schemas/user.schema'; import { User, UserSchema } from '../schemas/user.schema';
import { ClientsModule, Transport } from "@nestjs/microservices"; import { ClientsModule, Transport } from '@nestjs/microservices';
@Module({ @Module({
imports: [ imports: [
ClientsModule.register([ ClientsModule.register([
{ {
name: "SERVICIO_NOTIFICACIONES", name: 'SERVICIO_NOTIFICACIONES',
transport: Transport.TCP, transport: Transport.TCP,
options: { options: {
host: "127.0.0.1", host: '127.0.0.1',
port: 3009 port: 3009,
} },
} },
]), ]),
MongooseModule.forFeature([{ name: User.name, schema: UserSchema }]), MongooseModule.forFeature([{ name: User.name, schema: UserSchema }]),
], ],
controllers: [UsersController], controllers: [UsersController],
providers: [UsersService] providers: [UsersService],
}) })
export class UsersModule {} export class UsersModule {}

View File

@ -2,20 +2,18 @@ import { Injectable, Inject } from '@nestjs/common';
import { Model } from 'mongoose'; import { Model } from 'mongoose';
import { User, UserDocument } from '../schemas/user.schema'; import { User, UserDocument } from '../schemas/user.schema';
import { InjectModel } from '@nestjs/mongoose'; import { InjectModel } from '@nestjs/mongoose';
import { Md5 } from "md5-typescript"; import { Md5 } from 'md5-typescript';
import { map } from 'rxjs/operators'; import { map } from 'rxjs/operators';
import { RpcException, ClientProxy } from '@nestjs/microservices'; import { RpcException, ClientProxy } from '@nestjs/microservices';
@Injectable() @Injectable()
export class UsersService { export class UsersService {
constructor( constructor(
@InjectModel(User.name) private readonly userModel: Model<UserDocument>, @InjectModel(User.name) private readonly userModel: Model<UserDocument>,
@Inject('SERVICIO_NOTIFICACIONES') private readonly clientNotificationtApp: ClientProxy, @Inject('SERVICIO_NOTIFICACIONES')
private readonly clientNotificationtApp: ClientProxy,
) { } ) {}
private publicKey: string; private publicKey: string;
async create(user: UserDocument): Promise<User> { async create(user: UserDocument): Promise<User> {
let passwordEncriptada = Md5.init(user.password); let passwordEncriptada = Md5.init(user.password);
@ -24,10 +22,7 @@ export class UsersService {
} }
async findAll(): Promise<User[]> { async findAll(): Promise<User[]> {
return this.userModel return this.userModel.find().setOptions({ sanitizeFilter: true }).exec();
.find()
.setOptions({ sanitizeFilter: true })
.exec();
} }
async findOne(id: string): Promise<User> { async findOne(id: string): Promise<User> {
return this.userModel.findOne({ _id: id }).exec(); return this.userModel.findOne({ _id: id }).exec();
@ -56,13 +51,11 @@ export class UsersService {
repo.find({ email: email }).exec((err, res) => { repo.find({ email: email }).exec((err, res) => {
if (err) { if (err) {
reject(err); reject(err);
} } else {
else {
let passwordEncriptada = Md5.init(password); let passwordEncriptada = Md5.init(password);
if (res[0].password == passwordEncriptada) { if (res[0].password == passwordEncriptada) {
resolve(res[0]); resolve(res[0]);
} } else {
else {
resolve(null); resolve(null);
} }
} }
@ -77,7 +70,6 @@ export class UsersService {
return this.userModel.find({ user_type: 1 }).exec(); return this.userModel.find({ user_type: 1 }).exec();
} }
//find admin del sistema //find admin del sistema
async findGuardsCommunity(pcommunity_id: string): Promise<User[]> { async findGuardsCommunity(pcommunity_id: string): Promise<User[]> {
return this.userModel.find({ user_type: 4 }).exec(); return this.userModel.find({ user_type: 4 }).exec();
@ -87,11 +79,10 @@ export class UsersService {
return this.userModel.find({ user_type: 2 }).exec(); return this.userModel.find({ user_type: 2 }).exec();
} }
async testSendMail(user: UserDocument) { async testSendMail(user: UserDocument) {
let passwordEncriptada = Md5.init(user.password); let passwordEncriptada = Md5.init(user.password);
user.password = passwordEncriptada; user.password = passwordEncriptada;
this.userModel.create(user) this.userModel.create(user);
/*.then(() => { /*.then(() => {
} );*/ } );*/
@ -100,17 +91,19 @@ export class UsersService {
const payload = { email: user['email'], name: user['name'] }; const payload = { email: user['email'], name: user['name'] };
return this.clientNotificationtApp return this.clientNotificationtApp
.send<string>(pattern, payload) .send<string>(pattern, payload)
.pipe( .pipe(map((message: string) => ({ message })));
map((message: string) => ({ message })),
);
} }
async findCommunityUser(community_id: string, user_type: number): Promise<User> { async findCommunityUser(
return this.userModel.findOne({ community_id: community_id, user_type: user_type }).exec(); 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) { async deleteAdminSystem(id: string) {
return this.userModel.deleteOne({_id: id}).exec(); return this.userModel.deleteOne({ _id: id }).exec();
} }
} }

View File

@ -50,303 +50,394 @@ import './assets/demo/Demos.scss';
import './assets/layout/layout.scss'; import './assets/layout/layout.scss';
import './App.scss'; import './App.scss';
import LogIn from './components/LogIn'; import LogIn from './components/LogIn';
import {PrimeIcons} from 'primereact/api'; import { PrimeIcons } from 'primereact/api';
const App = () => { const App = () => {
const [layoutMode, setLayoutMode] = useState('static'); const [layoutMode, setLayoutMode] = useState('static');
const [layoutColorMode, setLayoutColorMode] = useState('light') const [layoutColorMode, setLayoutColorMode] = useState('light');
const [inputStyle, setInputStyle] = useState('outlined'); const [inputStyle, setInputStyle] = useState('outlined');
const [ripple, setRipple] = useState(true); const [ripple, setRipple] = useState(true);
const [staticMenuInactive, setStaticMenuInactive] = useState(false); const [staticMenuInactive, setStaticMenuInactive] = useState(false);
const [overlayMenuActive, setOverlayMenuActive] = useState(false); const [overlayMenuActive, setOverlayMenuActive] = useState(false);
const [mobileMenuActive, setMobileMenuActive] = useState(false); const [mobileMenuActive, setMobileMenuActive] = useState(false);
const [mobileTopbarMenuActive, setMobileTopbarMenuActive] = useState(false); const [mobileTopbarMenuActive, setMobileTopbarMenuActive] = useState(false);
const copyTooltipRef = useRef(); const copyTooltipRef = useRef();
const location = useLocation(); const location = useLocation();
PrimeReact.ripple = true; PrimeReact.ripple = true;
let menuClick = false; let menuClick = false;
let mobileTopbarMenuClick = false; let mobileTopbarMenuClick = false;
useEffect(() => { useEffect(() => {
if (mobileMenuActive) { if (mobileMenuActive) {
addClass(document.body, "body-overflow-hidden"); addClass(document.body, 'body-overflow-hidden');
} else { } else {
removeClass(document.body, "body-overflow-hidden"); removeClass(document.body, 'body-overflow-hidden');
} }
}, [mobileMenuActive]); }, [mobileMenuActive]);
useEffect(() => { useEffect(() => {
copyTooltipRef && copyTooltipRef.current && copyTooltipRef.current.updateTargetEvents(); copyTooltipRef &&
}, [location]); copyTooltipRef.current &&
copyTooltipRef.current.updateTargetEvents();
}, [location]);
const onInputStyleChange = (inputStyle) => { const onInputStyleChange = (inputStyle) => {
setInputStyle(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) => { if (!mobileTopbarMenuClick) {
PrimeReact.ripple = e.value; setMobileTopbarMenuActive(false);
setRipple(e.value)
} }
const onLayoutModeChange = (mode) => { mobileTopbarMenuClick = false;
setLayoutMode(mode) menuClick = false;
} };
const onColorModeChange = (mode) => { const onToggleMenuClick = (event) => {
setLayoutColorMode(mode) menuClick = true;
}
const onWrapperClick = (event) => { if (isDesktop()) {
if (!menuClick) { if (layoutMode === 'overlay') {
setOverlayMenuActive(false); if (mobileMenuActive === true) {
setMobileMenuActive(false); setOverlayMenuActive(true);
} }
if (!mobileTopbarMenuClick) { setOverlayMenuActive((prevState) => !prevState);
setMobileTopbarMenuActive(false); setMobileMenuActive(false);
} } else if (layoutMode === 'static') {
setStaticMenuInactive((prevState) => !prevState);
mobileTopbarMenuClick = false; }
menuClick = false; } else {
setMobileMenuActive((prevState) => !prevState);
} }
const onToggleMenuClick = (event) => { event.preventDefault();
menuClick = true; };
if (isDesktop()) { const onSidebarClick = () => {
if (layoutMode === 'overlay') { menuClick = true;
if (mobileMenuActive === true) { };
setOverlayMenuActive(true);
}
setOverlayMenuActive((prevState) => !prevState); const onMobileTopbarMenuClick = (event) => {
setMobileMenuActive(false); mobileTopbarMenuClick = true;
}
else if (layoutMode === 'static') {
setStaticMenuInactive((prevState) => !prevState);
}
}
else {
setMobileMenuActive((prevState) => !prevState);
}
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 = () => { const menu = [
menuClick = true; {
} label: 'Home',
items: [
const onMobileTopbarMenuClick = (event) => { { label: 'Dashboard', icon: 'pi pi-fw pi-home', to: '/' },
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 = [
{ {
label: 'Home', label: 'Administradores del sistema',
items: [ icon: PrimeIcons.USERS,
{label: 'Dashboard', icon: 'pi pi-fw pi-home', to: '/'}, to: '/administradoresSistema',
{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: 'UI Components', icon: 'pi pi-fw pi-sitemap', label: 'Administradores de comunidad',
items: [ icon: PrimeIcons.USERS,
{ label: 'Form Layout', icon: 'pi pi-fw pi-id-card', to: '/formlayout' }, to: '/administradoresComunidad',
{ 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: 'UI Blocks', label: 'Guardas de seguridad',
items: [ icon: PrimeIcons.LOCK,
{ label: 'Free Blocks', icon: 'pi pi-fw pi-eye', to: '/blocks', badge: "NEW" }, to: '/guardasSeguridad',
{ label: 'All Blocks', icon: 'pi pi-fw pi-globe', url: 'https://www.primefaces.org/primeblocks-react' }
]
}, },
{ {
label: 'Icons', label: 'Comunidadades',
items: [ icon: PrimeIcons.BUILDING,
{ label: 'PrimeIcons', icon: 'pi pi-fw pi-prime', to: '/icons' } 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', label: 'Invalid State',
items: [ icon: 'pi pi-fw pi-exclamation-circle',
{ label: 'Crud', icon: 'pi pi-fw pi-user-edit', to: '/crud' }, to: 'invalidstate',
{ label: 'Timeline', icon: 'pi pi-fw pi-calendar', to: '/timeline' }, },
{ label: 'Empty', icon: 'pi pi-fw pi-circle-off', to: '/empty' } { 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', label: 'All Blocks',
items: [ icon: 'pi pi-fw pi-globe',
{ url: 'https://www.primefaces.org/primeblocks-react',
label: 'Submenu 1', icon: 'pi pi-fw pi-bookmark', },
items: [ ],
{ },
label: 'Submenu 1.1', icon: 'pi pi-fw pi-bookmark', {
items: [ label: 'Icons',
{ label: 'Submenu 1.1.1', icon: 'pi pi-fw pi-bookmark' }, items: [{ label: 'PrimeIcons', icon: 'pi pi-fw pi-prime', to: '/icons' }],
{ label: 'Submenu 1.1.2', icon: 'pi pi-fw pi-bookmark' }, },
{ label: 'Submenu 1.1.3', icon: 'pi pi-fw pi-bookmark' }, {
] label: 'Pages',
}, icon: 'pi pi-fw pi-clone',
{ items: [
label: 'Submenu 1.2', icon: 'pi pi-fw pi-bookmark', { label: 'Crud', icon: 'pi pi-fw pi-user-edit', to: '/crud' },
items: [ { label: 'Timeline', icon: 'pi pi-fw pi-calendar', to: '/timeline' },
{ label: 'Submenu 1.2.1', icon: 'pi pi-fw pi-bookmark' }, { label: 'Empty', icon: 'pi pi-fw pi-circle-off', to: '/empty' },
{ label: 'Submenu 1.2.2', icon: 'pi pi-fw pi-bookmark' } ],
] },
}, {
] label: 'Menu Hierarchy',
}, icon: 'pi pi-fw pi-search',
{ items: [
label: 'Submenu 2', icon: 'pi pi-fw pi-bookmark', {
items: [ label: 'Submenu 1',
{ icon: 'pi pi-fw pi-bookmark',
label: 'Submenu 2.1', icon: 'pi pi-fw pi-bookmark', items: [
items: [ {
{ label: 'Submenu 2.1.1', icon: 'pi pi-fw pi-bookmark' }, label: 'Submenu 1.1',
{ label: 'Submenu 2.1.2', icon: 'pi pi-fw pi-bookmark' }, icon: 'pi pi-fw pi-bookmark',
{ label: 'Submenu 2.1.3', 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 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: '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) => { const addClass = (element, className) => {
if (element.classList) if (element.classList) element.classList.add(className);
element.classList.add(className); else element.className += ' ' + className;
else };
element.className += ' ' + className;
}
const removeClass = (element, className) => { const removeClass = (element, className) => {
if (element.classList) if (element.classList) element.classList.remove(className);
element.classList.remove(className); else
else element.className = element.className.replace(
element.className = element.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' '); new RegExp(
} '(^|\\b)' + className.split(' ').join('|') + '(\\b|$)',
'gi',
),
' ',
);
};
const wrapperClass = classNames('layout-wrapper', { const wrapperClass = classNames('layout-wrapper', {
'layout-overlay': layoutMode === 'overlay', 'layout-overlay': layoutMode === 'overlay',
'layout-static': layoutMode === 'static', 'layout-static': layoutMode === 'static',
'layout-static-sidebar-inactive': staticMenuInactive && layoutMode === 'static', 'layout-static-sidebar-inactive':
'layout-overlay-sidebar-active': overlayMenuActive && layoutMode === 'overlay', staticMenuInactive && layoutMode === 'static',
'layout-mobile-sidebar-active': mobileMenuActive, 'layout-overlay-sidebar-active':
'p-input-filled': inputStyle === 'filled', overlayMenuActive && layoutMode === 'overlay',
'p-ripple-disabled': ripple === false, 'layout-mobile-sidebar-active': mobileMenuActive,
'layout-theme-light': layoutColorMode === 'light' 'p-input-filled': inputStyle === 'filled',
}); 'p-ripple-disabled': ripple === false,
'layout-theme-light': layoutColorMode === 'light',
});
return ( return (
<div className={wrapperClass} onClick={onWrapperClick}> <div className={wrapperClass} onClick={onWrapperClick}>
<Tooltip ref={copyTooltipRef} target=".block-action-copy" position="bottom" content="Copied to clipboard" event="focus" /> <Tooltip
ref={copyTooltipRef}
target=".block-action-copy"
position="bottom"
content="Copied to clipboard"
event="focus"
/>
<AppTopbar onToggleMenuClick={onToggleMenuClick} layoutColorMode={layoutColorMode} <AppTopbar
mobileTopbarMenuActive={mobileTopbarMenuActive} onMobileTopbarMenuClick={onMobileTopbarMenuClick} onMobileSubTopbarMenuClick={onMobileSubTopbarMenuClick} /> onToggleMenuClick={onToggleMenuClick}
layoutColorMode={layoutColorMode}
<div className="layout-sidebar" onClick={onSidebarClick}> mobileTopbarMenuActive={mobileTopbarMenuActive}
<AppMenu model={menu} onMenuItemClick={onMenuItemClick} layoutColorMode={layoutColorMode} /> onMobileTopbarMenuClick={onMobileTopbarMenuClick}
</div> onMobileSubTopbarMenuClick={onMobileSubTopbarMenuClick}
/>
<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 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> </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; export default App;

View File

@ -1 +0,0 @@

View File

@ -3,6 +3,6 @@ import ReactDOM from 'react-dom';
import AppLayout from './App'; import AppLayout from './App';
it('renders without crashing', () => { it('renders without crashing', () => {
const div = document.createElement('div'); const div = document.createElement('div');
ReactDOM.render(<AppLayout />, div); ReactDOM.render(<AppLayout />, div);
}); });

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,20 @@
import React from 'react'; import React from 'react';
export const AppFooter = (props) => { export const AppFooter = (props) => {
return (
return ( <div className="layout-footer">
<div className="layout-footer"> <img
<img src={props.layoutColorMode === 'light' ? 'assets/layout/images/logo-dark.svg' : 'assets/layout/images/logo-white.svg'} alt="Logo" height="20" className="mr-2" /> src={
by props.layoutColorMode === 'light'
<span className="font-medium ml-2">PrimeReact</span> ? 'assets/layout/images/logo-dark.svg'
</div> : 'assets/layout/images/logo-white.svg'
); }
} alt="Logo"
height="20"
className="mr-2"
/>
by
<span className="font-medium ml-2">PrimeReact</span>
</div>
);
};

View File

@ -2,117 +2,175 @@ import React, { useState } from 'react';
import { NavLink } from 'react-router-dom'; import { NavLink } from 'react-router-dom';
import { CSSTransition } from 'react-transition-group'; import { CSSTransition } from 'react-transition-group';
import classNames from 'classnames'; import classNames from 'classnames';
import {Ripple} from "primereact/ripple"; import { Ripple } from 'primereact/ripple';
import { Badge } from 'primereact/badge'; import { Badge } from 'primereact/badge';
const AppSubmenu = (props) => { const AppSubmenu = (props) => {
const [activeIndex, setActiveIndex] = useState(null);
const [activeIndex, setActiveIndex] = useState(null) const onMenuItemClick = (event, item, index) => {
//avoid processing disabled items
const onMenuItemClick = (event, item, index) => { if (item.disabled) {
//avoid processing disabled items event.preventDefault();
if (item.disabled) { return true;
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 onKeyDown = (event) => { //execute command
if (event.code === 'Enter' || event.code === 'Space'){ if (item.command) {
event.preventDefault(); item.command({ originalEvent: event, item: item });
event.target.click();
}
} }
const renderLinkContent = (item) => { if (index === activeIndex) setActiveIndex(null);
let submenuIcon = item.items && <i className="pi pi-fw pi-angle-down menuitem-toggle-icon"></i>; else setActiveIndex(index);
let badge = item.badge && <Badge value={item.badge} />
return ( if (props.onMenuItemClick) {
<React.Fragment> props.onMenuItemClick({
<i className={item.icon}></i> originalEvent: event,
<span>{item.label}</span> item: item,
{submenuIcon} });
{badge}
<Ripple/>
</React.Fragment>
);
} }
};
const renderLink = (item, i) => { const onKeyDown = (event) => {
let content = renderLinkContent(item); if (event.code === 'Enter' || event.code === 'Space') {
event.preventDefault();
if (item.to) { event.target.click();
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) => { const renderLinkContent = (item) => {
let active = activeIndex === i; let submenuIcon = item.items && (
let styleClass = classNames(item.badgeStyleClass, {'layout-menuitem-category': props.root, 'active-menuitem': active && !item.to }); <i className="pi pi-fw pi-angle-down menuitem-toggle-icon"></i>
);
if(props.root) { let badge = item.badge && <Badge value={item.badge} />;
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 ( return (
<div className="layout-menu-container"> <React.Fragment>
<AppSubmenu items={props.model} className="layout-menu" onMenuItemClick={props.onMenuItemClick} root={true} role="menu" /> <i className={item.icon}></i>
<a href="https://www.primefaces.org/primeblocks-react" className="block mt-3"> <span>{item.label}</span>
<img alt="primeblocks" className="w-full" {submenuIcon}
src={props.layoutColorMode === 'light' ? 'assets/layout/images/banner-primeblocks.png' : 'assets/layout/images/banner-primeblocks-dark.png'}/> {badge}
</a> <Ripple />
</div> </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>
);
};

View File

@ -3,42 +3,44 @@ import { Link } from 'react-router-dom';
import classNames from 'classnames'; import classNames from 'classnames';
export const AppTopbar = (props) => { 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 ( {/* <button type="button" className="p-link layout-menu-button layout-topbar-button" onClick={props.onToggleMenuClick}>
<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}>
<i className="pi pi-bars"/> <i className="pi pi-bars"/>
</button> */} </button> */}
<button type="button" className="p-link layout-topbar-menu-button layout-topbar-button" > <button
<i className="pi pi-ellipsis-v" /> type="button"
</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"> <ul className="layout-topbar-menu lg:flex origin-top">
{/* <li> {/* <li>
<button className="p-link layout-topbar-button" onClick={props.onMobileSubTopbarMenuClick}> <button className="p-link layout-topbar-button" onClick={props.onMobileSubTopbarMenuClick}>
<i className="pi pi-calendar"/> <i className="pi pi-calendar"/>
<span>Events</span> <span>Events</span>
</button> </button>
</li> */} </li> */}
{/* <li> {/* <li>
<button className="p-link layout-topbar-button" onClick={props.onMobileSubTopbarMenuClick}> <button className="p-link layout-topbar-button" onClick={props.onMobileSubTopbarMenuClick}>
<i className="pi pi-cog"/> <i className="pi pi-cog"/>
<span>Settings</span> <span>Settings</span>
</button> </button>
</li> */} </li> */}
<li> <li>
<button className="p-link layout-topbar-button" > <button className="p-link layout-topbar-button">
<i className="pi pi-user" /> <i className="pi pi-user" />
<span>Profile</span> <span>Profile</span>
</button> </button>
</li> </li>
</ul> </ul>
</div> </div>
); );
} };

View File

@ -3,47 +3,63 @@ import { classNames } from 'primereact/utils';
import { CodeHighlight } from './templates/CodeHighlight'; import { CodeHighlight } from './templates/CodeHighlight';
const BlockViewer = (props) => { 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) => { return (
await navigator.clipboard.writeText(props.code); <div className="block-viewer">
event.preventDefault(); <div className="block-section">
} <div className="block-header">
<span className="block-title">
return ( <span>{props.header}</span>
<div className="block-viewer"> {props.new && <span className="badge-new">New</span>}
<div className="block-section"> </span>
<div className="block-header"> <div className="block-actions">
<span className="block-title"> <button
<span>{props.header}</span> tabIndex="0"
{props.new && <span className="badge-new">New</span>} className={classNames('p-link', {
</span> 'block-action-active': blockView === 'PREVIEW',
<div className="block-actions"> })}
<button tabIndex="0" className={classNames('p-link', { 'block-action-active': blockView === 'PREVIEW' })} onClick={() => setBlockView('PREVIEW')}><span>Preview</span></button> onClick={() => setBlockView('PREVIEW')}
<button className={classNames('p-link', { 'block-action-active': blockView === 'CODE' })} onClick={() => setBlockView('CODE')} > >
<span>Code</span> <span>Preview</span>
</button> </button>
<button tabIndex="0" className="p-link block-action-copy" onClick={copyCode}> <button
<i className="pi pi-copy"></i> className={classNames('p-link', {
</button> 'block-action-active': blockView === 'CODE',
</div> })}
</div> onClick={() => setBlockView('CODE')}
<div className="block-content"> >
{blockView === 'PREVIEW' && <span>Code</span>
<div className={props.containerClassName} style={props.previewStyle}> </button>
{props.children} <button
</div>} tabIndex="0"
className="p-link block-action-copy"
{blockView === 'CODE' && onClick={copyCode}
<CodeHighlight> >
{props.code} <i className="pi pi-copy"></i>
</CodeHighlight> </button>
} </div>
</div>
</div>
</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; export default BlockViewer;

View File

@ -2,14 +2,13 @@ import { useEffect } from 'react';
import { useLocation, withRouter } from 'react-router-dom'; import { useLocation, withRouter } from 'react-router-dom';
const ScrollToTop = (props) => { const ScrollToTop = (props) => {
let location = useLocation();
let location = useLocation(); useEffect(() => {
window.scrollTo(0, 0);
}, [location]);
useEffect(() => { return props.children;
window.scrollTo(0, 0) };
}, [location]);
return props.children;
}
export default withRouter(ScrollToTop); export default withRouter(ScrollToTop);

View File

@ -1,95 +1,95 @@
.customer-badge, .customer-badge,
.product-badge, .product-badge,
.order-badge { .order-badge {
border-radius: var(--border-radius); border-radius: var(--border-radius);
padding: .25em .5rem; padding: 0.25em 0.5rem;
text-transform: uppercase; text-transform: uppercase;
font-weight: 700; font-weight: 700;
font-size: 12px; font-size: 12px;
letter-spacing: .3px; letter-spacing: 0.3px;
} }
.customer-badge { .customer-badge {
&.status-qualified { &.status-qualified {
background: #C8E6C9; background: #c8e6c9;
color: #256029; color: #256029;
} }
&.status-unqualified { &.status-unqualified {
background: #FFCDD2; background: #ffcdd2;
color: #C63737; color: #c63737;
} }
&.status-negotiation { &.status-negotiation {
background: #FEEDAF; background: #feedaf;
color: #8A5340; color: #8a5340;
} }
&.status-new { &.status-new {
background: #B3E5FC; background: #b3e5fc;
color: #23547B; color: #23547b;
} }
&.status-renewal { &.status-renewal {
background: #ECCFFF; background: #eccfff;
color: #694382; color: #694382;
} }
&.status-proposal { &.status-proposal {
background: #FFD8B2; background: #ffd8b2;
color: #805B36; color: #805b36;
} }
} }
.product-badge { .product-badge {
border-radius: var(--border-radius); border-radius: var(--border-radius);
padding: .25em .5rem; padding: 0.25em 0.5rem;
text-transform: uppercase; text-transform: uppercase;
font-weight: 700; font-weight: 700;
font-size: 12px; font-size: 12px;
letter-spacing: .3px; letter-spacing: 0.3px;
&.status-instock { &.status-instock {
background: #C8E6C9; background: #c8e6c9;
color: #256029; color: #256029;
} }
&.status-outofstock { &.status-outofstock {
background: #FFCDD2; background: #ffcdd2;
color: #C63737; color: #c63737;
} }
&.status-lowstock { &.status-lowstock {
background: #FEEDAF; background: #feedaf;
color: #8A5340; color: #8a5340;
} }
} }
.order-badge { .order-badge {
border-radius: var(--border-radius); border-radius: var(--border-radius);
padding: .25em .5rem; padding: 0.25em 0.5rem;
text-transform: uppercase; text-transform: uppercase;
font-weight: 700; font-weight: 700;
font-size: 12px; font-size: 12px;
letter-spacing: .3px; letter-spacing: 0.3px;
&.order-delivered { &.order-delivered {
background: #C8E6C9; background: #c8e6c9;
color: #256029; color: #256029;
} }
&.order-cancelled { &.order-cancelled {
background: #FFCDD2; background: #ffcdd2;
color: #C63737; color: #c63737;
} }
&.order-pending { &.order-pending {
background: #FEEDAF; background: #feedaf;
color: #8A5340; color: #8a5340;
} }
&.order-returned { &.order-returned {
background: #ECCFFF; background: #eccfff;
color: #694382; color: #694382;
} }
} }

View File

@ -1,147 +1,149 @@
.block-viewer { .block-viewer {
.block-section { .block-section {
margin-bottom: 4rem; margin-bottom: 4rem;
overflow: hidden; 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 { .block-actions {
padding: 1rem 2rem; display: flex;
background-color: var(--surface-section); align-items: center;
border-top-left-radius: 12px; justify-content: space-between;
border-top-right-radius: 12px; user-select: none;
border:1px solid var(--surface-d); margin-left: 1rem;
a,
button {
display: flex; display: flex;
align-items: center; 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 { &:last-child {
font-weight: 700; margin-right: 0;
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;
}
} }
.block-actions { &:not(.block-action-disabled):hover {
display: flex; background-color: var(--surface-c);
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;
} }
code { &.block-action-active {
border-left: 0 none !important; border-color: var(--primary-color);
box-shadow: none !important; color: var(--primary-color);
background: var(--surface-e) !important; }
&.block-action-copy {
i {
color: var(--primary-color);
font-size: 1.25rem;
margin: 0; 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) { code {
.block-header { border-left: 0 none !important;
flex-direction: column; box-shadow: none !important;
align-items: start; background: var(--surface-e) !important;
margin: 0;
color: var(--text-color);
font-size: 14px;
padding: 0 2rem !important;
.block-actions { .token {
margin-top: 1rem; &.tag,
margin-left: 0; &.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;
}
}
}
} }

View File

@ -1,60 +1,61 @@
.docs { .docs {
i:not([class~="pi"]) { i:not([class~='pi']) {
background-color: transparent; background-color: transparent;
color: #2196f3; color: #2196f3;
font-family: Monaco, courier, monospace; font-family: Monaco, courier, monospace;
font-style: normal; font-style: normal;
font-size: 12px; font-size: 12px;
font-weight: 500; font-weight: 500;
padding: 0 4px; padding: 0 4px;
letter-spacing: .5px; letter-spacing: 0.5px;
font-weight: 600; font-weight: 600;
margin: 0 2px; margin: 0 2px;
display: inline-flex; display: inline-flex;
}
a {
font-weight: 500;
}
pre[class*='language-'] {
&:before,
&:after {
display: none !important;
} }
a { code {
font-weight: 500; 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-"] { .token {
&:before, &:after { &.tag,
display: none !important; &.keyword {
} color: #2196f3 !important;
}
code { &.attr-name,
border-left: 6px solid var(--surface-border) !important; &.attr-string {
box-shadow: none !important; color: #2196f3 !important;
background: var(--surface-ground) !important; }
margin: 1em 0;
color: var(--text-color);
font-size: 14px;
}
.token { &.attr-value {
&.tag, color: #4caf50 !important;
&.keyword { }
color: #2196F3 !important;
}
&.attr-name, &.punctuation {
&.attr-string { color: var(--text-color);
color: #2196F3 !important; }
}
&.attr-value { &.operator,
color: #4CAF50 !important; &.variable,
} &.string {
background: transparent;
&.punctuation { }
color: var(--text-color);
}
&.operator,
&.variable,
&.string {
background: transparent;
}
}
} }
}
} }

View File

@ -1,16 +1,16 @@
.media-demo { .media-demo {
.product-item { .product-item {
.product-item-content { .product-item-content {
border: 1px solid var(--surface-d); border: 1px solid var(--surface-d);
border-radius: 3px; border-radius: 3px;
margin: 0.3rem; margin: 0.3rem;
text-align: center; text-align: center;
padding: 2rem 0; padding: 2rem 0;
}
.product-image {
width: 50%;
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
}
} }
.product-image {
width: 50%;
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
}
}
} }

View File

@ -1,16 +1,16 @@
.table-demo { .table-demo {
.p-datatable-frozen-tbody { .p-datatable-frozen-tbody {
font-weight: bold; font-weight: bold;
} }
.p-datatable-scrollable { .p-datatable-scrollable {
.p-frozen-column { .p-frozen-column {
font-weight: bold; font-weight: bold;
}
} }
}
.image-text { .image-text {
vertical-align: middle; vertical-align: middle;
margin-left: .5rem; margin-left: 0.5rem;
} }
} }

View File

@ -1,26 +1,26 @@
.timeline-demo { .timeline-demo {
.p-timeline-event-content, .p-timeline-event-content,
.p-timeline-event-opposite { .p-timeline-event-opposite {
line-height: 1; line-height: 1;
} }
@media screen and (max-width: 960px) { @media screen and (max-width: 960px) {
.customized-timeline { .customized-timeline {
.p-timeline-event:nth-child(even) { .p-timeline-event:nth-child(even) {
flex-direction: row !important; flex-direction: row !important;
.p-timeline-event-content { .p-timeline-event-content {
text-align: left !important; text-align: left !important;
}
}
.p-timeline-event-opposite {
flex: 0;
}
.p-card {
margin-top: 1rem;
}
} }
}
.p-timeline-event-opposite {
flex: 0;
}
.p-card {
margin-top: 1rem;
}
} }
}
} }

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
/* General */ /* General */
$fontSize:10px; $fontSize: 10px;
$borderRadius:12px; $borderRadius: 12px;
$transitionDuration:.2s; $transitionDuration: 0.2s;

View File

@ -1,3 +1,3 @@
@import "./_variables"; @import './_variables';
@import "./sass/_layout"; @import './sass/_layout';
@import "./_overrides"; @import './_overrides';

View File

@ -1,103 +1,104 @@
.layout-config { .layout-config {
position: fixed; position: fixed;
top: 0; top: 0;
padding: 0; padding: 0;
right: 0; right: 0;
width: 20rem; width: 20rem;
z-index: 999; z-index: 999;
height: 100vh;
transform: translateX(100%);
transition: transform $transitionDuration;
backface-visibility: hidden;
box-shadow: 0px 3px 5px rgba(0, 0, 0, 0.02), 0px 0px 2px rgba(0, 0, 0, 0.05),
0px 1px 4px rgba(0, 0, 0, 0.08) !important;
color: var(--text-color);
background-color: var(--surface-overlay);
border-top-left-radius: 12px;
border-bottom-left-radius: 12px;
&.layout-config-active {
transform: translateX(0);
}
.layout-config-button {
display: block;
position: absolute;
width: 52px;
height: 52px;
line-height: 52px;
background-color: var(--primary-color);
color: var(--primary-color-text);
text-align: center;
top: 230px;
left: -52px;
z-index: -1;
overflow: hidden;
cursor: pointer;
border-top-left-radius: $borderRadius;
border-bottom-left-radius: $borderRadius;
border-bottom-right-radius: 0;
border-top-right-radius: 0;
transition: background-color $transitionDuration;
i {
font-size: 32px;
line-height: inherit;
cursor: pointer;
transform: rotate(0deg);
transition: color $transitionDuration, transform 1s;
}
}
.layout-config-close {
position: absolute;
right: 1rem;
top: 1rem;
z-index: 1;
}
.layout-config-content {
position: relative;
overflow: auto;
height: 100vh; height: 100vh;
transform: translateX(100%); padding: 2rem;
transition: transform $transitionDuration; }
backface-visibility: hidden;
box-shadow: 0px 3px 5px rgba(0,0,0,.02), 0px 0px 2px rgba(0,0,0,.05), 0px 1px 4px rgba(0,0,0,.08) !important;
color: var(--text-color);
background-color: var(--surface-overlay);
border-top-left-radius: 12px;
border-bottom-left-radius: 12px;
&.layout-config-active { .config-scale {
transform: translateX(0); display: flex;
align-items: center;
margin: 1rem 0 2rem 0;
.p-button {
margin-right: 0.5rem;
} }
.layout-config-button { i {
display: block; margin-right: 0.5rem;
position: absolute; font-size: 0.75rem;
width: 52px; color: var(--text-color-secondary);
height: 52px;
line-height: 52px;
background-color: var(--primary-color);
color: var(--primary-color-text);
text-align: center;
top: 230px;
left: -52px;
z-index: -1;
overflow: hidden;
cursor: pointer;
border-top-left-radius: $borderRadius;
border-bottom-left-radius: $borderRadius;
border-bottom-right-radius: 0;
border-top-right-radius: 0;
transition: background-color $transitionDuration;
i { &.scale-active {
font-size: 32px; font-size: 1.25rem;
line-height: inherit; color: var(--primary-color);
cursor: pointer; }
transform: rotate(0deg); }
transition: color $transitionDuration, transform 1s; }
}
.free-themes {
img {
width: 2rem;
border-radius: 4px;
transition: transform 0.2s;
display: block;
&:hover {
transform: scale(1.1);
}
} }
.layout-config-close { span {
position: absolute; font-size: 0.75rem;
right: 1rem; margin-top: 0.25rem;
top: 1rem;
z-index: 1;
}
.layout-config-content {
position: relative;
overflow: auto;
height: 100vh;
padding: 2rem;
}
.config-scale {
display: flex;
align-items: center;
margin: 1rem 0 2rem 0;
.p-button {
margin-right: .5rem;
}
i {
margin-right: .5rem;
font-size: .75rem;
color: var(--text-color-secondary);
&.scale-active {
font-size: 1.25rem;
color: var(--primary-color);
}
}
}
.free-themes {
img {
width: 2rem;
border-radius: 4px;
transition: transform .2s;
display: block;
&:hover {
transform: scale(1.1);
}
}
span {
font-size: .75rem;
margin-top: .25rem;
}
} }
}
} }

View File

@ -1,12 +1,12 @@
.layout-main-container { .layout-main-container {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
min-height: 100vh; min-height: 100vh;
justify-content: space-between; justify-content: space-between;
padding: 7rem 2rem 2rem 4rem; padding: 7rem 2rem 2rem 4rem;
transition: margin-left $transitionDuration; transition: margin-left $transitionDuration;
} }
.layout-main { .layout-main {
flex: 1 1 auto; flex: 1 1 auto;
} }

View File

@ -1,8 +1,8 @@
.layout-footer { .layout-footer {
transition: margin-left $transitionDuration; transition: margin-left $transitionDuration;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
padding-top: 1rem; padding-top: 1rem;
border-top: 1px solid var(--surface-border); border-top: 1px solid var(--surface-border);
} }

View File

@ -1,11 +1,11 @@
@import "./_mixins"; @import './_mixins';
@import "./_splash"; @import './_splash';
@import "./_main"; @import './_main';
@import "./_topbar"; @import './_topbar';
@import "./_menu"; @import './_menu';
@import "./_config"; @import './_config';
@import "./_content"; @import './_content';
@import "./_footer"; @import './_footer';
@import "./_responsive"; @import './_responsive';
@import "./_utils"; @import './_utils';
@import "./_typography"; @import './_typography';

View File

@ -1,28 +1,29 @@
* { * {
box-sizing: border-box; box-sizing: border-box;
} }
html { html {
height: 100%; height: 100%;
font-size: $fontSize; font-size: $fontSize;
} }
body { body {
font-family: var(--font-family); font-family: var(--font-family);
color: var(--text-color); color: var(--text-color);
background-color: var(--surface-ground); background-color: var(--surface-ground);
margin: 0; margin: 0;
padding: 0; padding: 0;
min-height: 100%; min-height: 100%;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }
a, button { a,
text-decoration: none; button {
color: var(--primary-color); text-decoration: none;
color: var(--primary-color);
} }
.layout-theme-light { .layout-theme-light {
background-color: #edf1f5; background-color: #edf1f5;
} }

View File

@ -1,120 +1,121 @@
.layout-sidebar { .layout-sidebar {
position: fixed; position: fixed;
width: 300px; width: 300px;
height: calc(100vh - 9rem); height: calc(100vh - 9rem);
z-index: 999; z-index: 999;
overflow-y: auto; overflow-y: auto;
user-select: none; user-select: none;
top: 7rem; top: 7rem;
left: 2rem; left: 2rem;
transition: transform $transitionDuration, left $transitionDuration; transition: transform $transitionDuration, left $transitionDuration;
background-color: var(--surface-overlay); background-color: var(--surface-overlay);
border-radius: 12px; border-radius: 12px;
padding: 1.5rem; padding: 1.5rem;
box-shadow: 0px 3px 5px rgba(0,0,0,.02), 0px 0px 2px rgba(0,0,0,.05), 0px 1px 4px rgba(0,0,0,.08) box-shadow: 0px 3px 5px rgba(0, 0, 0, 0.02), 0px 0px 2px rgba(0, 0, 0, 0.05),
0px 1px 4px rgba(0, 0, 0, 0.08);
} }
.layout-menu { .layout-menu {
list-style-type: none; list-style-type: none;
margin: 0; margin: 0;
padding: 0; padding: 0;
li { li {
&.layout-menuitem-category { &.layout-menuitem-category {
margin-top: .75rem; margin-top: 0.75rem;
&:first-child { &:first-child {
margin-top: 0; margin-top: 0;
} }
}
.layout-menuitem-root-text {
text-transform: uppercase;
color:var(--surface-900);
font-weight: 600;
margin-bottom: .5rem;
font-size: .875rem;
}
a {
cursor: pointer;
text-decoration: none;
display: flex;
align-items: center;
color:var(--text-color);
transition: color $transitionDuration;
border-radius: $borderRadius;
padding: .75rem 1rem;
transition: background-color .15s;
span {
margin-left: 0.5rem;
}
.menuitem-toggle-icon {
margin-left: auto;
}
&:focus {
@include focused-inset();
}
&:hover {
background-color: var(--surface-hover);
}
&.router-link-exact-active {
font-weight: 700;
color: var(--primary-color);
}
.p-badge {
margin-left: auto;
}
}
&.active-menuitem {
> a {
.menuitem-toggle-icon {
&:before {
content: '\e933';
}
}
}
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
&.layout-submenu-wrapper-enter {
max-height: 0;
}
&.layout-submenu-wrapper-enter-active {
overflow: hidden;
max-height: 1000px;
transition: max-height 1s ease-in-out;
}
&.layout-submenu-wrapper-enter-done {
transform: none;
}
&.layout-submenu-wrapper-exit {
max-height: 1000px;
}
&.layout-submenu-wrapper-exit-active {
overflow: hidden;
max-height: 0;
transition: max-height 0.45s cubic-bezier(0.86, 0, 0.07, 1);
}
ul {
padding-left: 1rem;
}
}
} }
.layout-menuitem-root-text {
text-transform: uppercase;
color: var(--surface-900);
font-weight: 600;
margin-bottom: 0.5rem;
font-size: 0.875rem;
}
a {
cursor: pointer;
text-decoration: none;
display: flex;
align-items: center;
color: var(--text-color);
transition: color $transitionDuration;
border-radius: $borderRadius;
padding: 0.75rem 1rem;
transition: background-color 0.15s;
span {
margin-left: 0.5rem;
}
.menuitem-toggle-icon {
margin-left: auto;
}
&:focus {
@include focused-inset();
}
&:hover {
background-color: var(--surface-hover);
}
&.router-link-exact-active {
font-weight: 700;
color: var(--primary-color);
}
.p-badge {
margin-left: auto;
}
}
&.active-menuitem {
> a {
.menuitem-toggle-icon {
&:before {
content: '\e933';
}
}
}
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
&.layout-submenu-wrapper-enter {
max-height: 0;
}
&.layout-submenu-wrapper-enter-active {
overflow: hidden;
max-height: 1000px;
transition: max-height 1s ease-in-out;
}
&.layout-submenu-wrapper-enter-done {
transform: none;
}
&.layout-submenu-wrapper-exit {
max-height: 1000px;
}
&.layout-submenu-wrapper-exit-active {
overflow: hidden;
max-height: 0;
transition: max-height 0.45s cubic-bezier(0.86, 0, 0.07, 1);
}
ul {
padding-left: 1rem;
}
}
}
} }

View File

@ -1,13 +1,13 @@
@mixin focused() { @mixin focused() {
outline: 0 none; outline: 0 none;
outline-offset: 0; outline-offset: 0;
transition: box-shadow .2s; transition: box-shadow 0.2s;
box-shadow: var(--focus-ring); box-shadow: var(--focus-ring);
} }
@mixin focused-inset() { @mixin focused-inset() {
outline: 0 none; outline: 0 none;
outline-offset: 0; outline-offset: 0;
transition: box-shadow .2s; transition: box-shadow 0.2s;
box-shadow: inset var(--focus-ring); box-shadow: inset var(--focus-ring);
} }

View File

@ -1,89 +1,89 @@
@media (min-width: 992px) { @media (min-width: 992px) {
.layout-wrapper { .layout-wrapper {
&.layout-overlay { &.layout-overlay {
.layout-main-container { .layout-main-container {
margin-left: 0; margin-left: 0;
padding-left: 2rem; padding-left: 2rem;
} }
.layout-sidebar { .layout-sidebar {
transform: translateX(-100%); transform: translateX(-100%);
left: 0; left: 0;
top: 0; top: 0;
height: 100vh; height: 100vh;
border-top-left-radius: 0; border-top-left-radius: 0;
border-bottom-left-radius: 0; border-bottom-left-radius: 0;
} }
&.layout-overlay-sidebar-active { &.layout-overlay-sidebar-active {
.layout-sidebar { .layout-sidebar {
transform: translateX(0); transform: translateX(0);
}
}
}
&.layout-static {
.layout-main-container {
margin-left: 300px;
}
&.layout-static-sidebar-inactive {
.layout-sidebar {
transform: translateX(-100%);
left: 0;
}
.layout-main-container {
margin-left: 0;
padding-left: 2rem;
}
}
}
.layout-mask {
display: none;
} }
}
} }
&.layout-static {
.layout-main-container {
margin-left: 300px;
}
&.layout-static-sidebar-inactive {
.layout-sidebar {
transform: translateX(-100%);
left: 0;
}
.layout-main-container {
margin-left: 0;
padding-left: 2rem;
}
}
}
.layout-mask {
display: none;
}
}
} }
@media (max-width: 991px) { @media (max-width: 991px) {
.layout-wrapper { .layout-wrapper {
.layout-main-container { .layout-main-container {
margin-left: 0; margin-left: 0;
padding-left: 2rem; padding-left: 2rem;
}
.layout-sidebar {
transform: translateX(-100%);
left: 0;
top: 0;
height: 100vh;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
.layout-mask {
z-index: 998;
background-color: var(--mask-bg);
&.layout-mask-enter-from,
&.layout-mask-leave-to {
background-color: transparent;
}
}
&.layout-mobile-sidebar-active {
.layout-sidebar {
transform: translateX(0);
}
.layout-mask {
display: block;
}
}
} }
.body-overflow-hidden { .layout-sidebar {
overflow: hidden; transform: translateX(-100%);
left: 0;
top: 0;
height: 100vh;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
} }
.layout-mask {
z-index: 998;
background-color: var(--mask-bg);
&.layout-mask-enter-from,
&.layout-mask-leave-to {
background-color: transparent;
}
}
&.layout-mobile-sidebar-active {
.layout-sidebar {
transform: translateX(0);
}
.layout-mask {
display: block;
}
}
}
.body-overflow-hidden {
overflow: hidden;
}
} }

View File

@ -1,47 +1,48 @@
.preloader { .preloader {
position: fixed; position: fixed;
z-index: 999999; z-index: 999999;
background: #edf1f5; background: #edf1f5;
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.preloader-content { .preloader-content {
border: 0 solid transparent; border: 0 solid transparent;
border-radius: 50%; border-radius: 50%;
width: 150px; width: 150px;
height: 150px; height: 150px;
position: absolute; position: absolute;
top: calc(50vh - 75px); top: calc(50vh - 75px);
left: calc(50vw - 75px); left: calc(50vw - 75px);
} }
.preloader-content:before, .preloader-content:after{ .preloader-content:before,
content: ''; .preloader-content:after {
border: 1em solid var(--primary-color); content: '';
border-radius: 50%; border: 1em solid var(--primary-color);
width: inherit; border-radius: 50%;
height: inherit; width: inherit;
position: absolute; height: inherit;
top: 0; position: absolute;
left: 0; top: 0;
animation: loader 2s linear infinite; left: 0;
animation: loader 2s linear infinite;
opacity: 0;
}
.preloader-content:before {
animation-delay: 0.5s;
}
@keyframes loader {
0% {
transform: scale(0);
opacity: 0; opacity: 0;
} }
50% {
.preloader-content:before{ opacity: 1;
animation-delay: 0.5s; }
} 100% {
transform: scale(1);
@keyframes loader{ opacity: 0;
0%{ }
transform: scale(0);
opacity: 0;
}
50%{
opacity: 1;
}
100%{
transform: scale(1);
opacity: 0;
}
} }

View File

@ -1,149 +1,151 @@
.layout-topbar { .layout-topbar {
position: fixed; position: fixed;
height: 5rem; height: 5rem;
z-index: 997; z-index: 997;
left: 0; left: 0;
top: 0; top: 0;
width: 100%; width: 100%;
padding: 0 2rem; padding: 0 2rem;
background-color: var(--surface-card); background-color: var(--surface-card);
transition: left $transitionDuration; transition: left $transitionDuration;
display: flex;
align-items: center;
box-shadow: 0px 3px 5px rgba(0, 0, 0, 0.02), 0px 0px 2px rgba(0, 0, 0, 0.05),
0px 1px 4px rgba(0, 0, 0, 0.08);
.layout-topbar-logo {
display: flex; display: flex;
align-items: center; align-items: center;
box-shadow: 0px 3px 5px rgba(0,0,0,.02), 0px 0px 2px rgba(0,0,0,.05), 0px 1px 4px rgba(0,0,0,.08); color: var(--surface-900);
font-size: 1.5rem;
font-weight: 500;
width: 300px;
border-radius: 12px;
.layout-topbar-logo { img {
display: flex; height: 2.5rem;
align-items: center; margin-right: 0.5rem;
color: var(--surface-900);
font-size: 1.5rem;
font-weight: 500;
width: 300px;
border-radius: 12px;
img {
height: 2.5rem;
margin-right: .5rem;
}
&:focus {
@include focused();
}
} }
&:focus {
@include focused();
}
}
.layout-topbar-button {
display: inline-flex;
justify-content: center;
align-items: center;
position: relative;
color: var(--text-color-secondary);
border-radius: 50%;
width: 3rem;
height: 3rem;
cursor: pointer;
transition: background-color $transitionDuration;
&:hover {
color: var(--text-color);
background-color: var(--surface-hover);
}
&:focus {
@include focused();
}
i {
font-size: 1.5rem;
}
span {
font-size: 1rem;
display: none;
}
}
.layout-menu-button {
margin-left: 2rem;
}
.layout-topbar-menu-button {
display: none;
i {
font-size: 1.25rem;
}
}
.layout-topbar-menu {
margin: 0 0 0 auto;
padding: 0;
list-style: none;
display: flex;
.layout-topbar-button { .layout-topbar-button {
display: inline-flex; margin-left: 1rem;
justify-content: center;
align-items: center;
position: relative;
color: var(--text-color-secondary);
border-radius: 50%;
width: 3rem;
height: 3rem;
cursor: pointer;
transition: background-color $transitionDuration;
&:hover {
color: var(--text-color);
background-color: var(--surface-hover);
}
&:focus {
@include focused();
}
i {
font-size: 1.5rem;
}
span {
font-size: 1rem;
display: none;
}
}
.layout-menu-button {
margin-left: 2rem;
}
.layout-topbar-menu-button {
display: none;
i {
font-size: 1.25rem;
}
}
.layout-topbar-menu {
margin: 0 0 0 auto;
padding: 0;
list-style: none;
display: flex;
.layout-topbar-button {
margin-left: 1rem;
}
} }
}
} }
@media (max-width: 991px) { @media (max-width: 991px) {
.layout-topbar { .layout-topbar {
justify-content: space-between; justify-content: space-between;
.layout-topbar-logo { .layout-topbar-logo {
width: auto; width: auto;
order: 2; order: 2;
}
.layout-menu-button {
margin-left: 0;
order: 1;
}
.layout-topbar-menu-button {
display: inline-flex;
margin-left: 0;
order: 3;
}
.layout-topbar-menu {
margin-left: 0;
position: absolute;
flex-direction: column;
background-color: var(--surface-overlay);
box-shadow: 0px 3px 5px rgba(0,0,0,.02), 0px 0px 2px rgba(0,0,0,.05), 0px 1px 4px rgba(0,0,0,.08);
border-radius: 12px;
padding: 1rem;
right: 2rem;
top: 5rem;
min-width: 15rem;
display: none;
-webkit-animation: scalein 0.15s linear;
animation: scalein 0.15s linear;
&.layout-topbar-menu-mobile-active {
display: block
}
.layout-topbar-button {
margin-left: 0;
display: flex;
width: 100%;
height: auto;
justify-content: flex-start;
border-radius: 12px;
padding: 1rem;
i {
font-size: 1rem;
margin-right: .5rem;
}
span {
font-weight: medium;
display: block;
}
}
}
} }
.layout-menu-button {
margin-left: 0;
order: 1;
}
.layout-topbar-menu-button {
display: inline-flex;
margin-left: 0;
order: 3;
}
.layout-topbar-menu {
margin-left: 0;
position: absolute;
flex-direction: column;
background-color: var(--surface-overlay);
box-shadow: 0px 3px 5px rgba(0, 0, 0, 0.02),
0px 0px 2px rgba(0, 0, 0, 0.05), 0px 1px 4px rgba(0, 0, 0, 0.08);
border-radius: 12px;
padding: 1rem;
right: 2rem;
top: 5rem;
min-width: 15rem;
display: none;
-webkit-animation: scalein 0.15s linear;
animation: scalein 0.15s linear;
&.layout-topbar-menu-mobile-active {
display: block;
}
.layout-topbar-button {
margin-left: 0;
display: flex;
width: 100%;
height: auto;
justify-content: flex-start;
border-radius: 12px;
padding: 1rem;
i {
font-size: 1rem;
margin-right: 0.5rem;
}
span {
font-weight: medium;
display: block;
}
}
}
}
} }

View File

@ -1,63 +1,68 @@
h1, h2, h3, h4, h5, h6 { h1,
margin: 1.5rem 0 1rem 0; h2,
font-family: inherit; h3,
font-weight: 500; h4,
line-height: 1.2; h5,
color: inherit; h6 {
margin: 1.5rem 0 1rem 0;
font-family: inherit;
font-weight: 500;
line-height: 1.2;
color: inherit;
&:first-child { &:first-child {
margin-top: 0; margin-top: 0;
} }
} }
h1 { h1 {
font-size: 2.5rem; font-size: 2.5rem;
} }
h2 { h2 {
font-size: 2rem; font-size: 2rem;
} }
h3 { h3 {
font-size: 1.75rem; font-size: 1.75rem;
} }
h4 { h4 {
font-size: 1.5rem; font-size: 1.5rem;
} }
h5 { h5 {
font-size: 1.25rem; font-size: 1.25rem;
} }
h6 { h6 {
font-size: 1rem; font-size: 1rem;
} }
mark { mark {
background: #FFF8E1; background: #fff8e1;
padding: .25rem .4rem; padding: 0.25rem 0.4rem;
border-radius: $borderRadius; border-radius: $borderRadius;
font-family: monospace; font-family: monospace;
} }
blockquote { blockquote {
margin: 1rem 0; margin: 1rem 0;
padding: 0 2rem; padding: 0 2rem;
border-left: 4px solid #90A4AE; border-left: 4px solid #90a4ae;
} }
hr { hr {
border-top: solid var(--surface-border); border-top: solid var(--surface-border);
border-width: 1px 0 0 0; border-width: 1px 0 0 0;
margin: 1rem 0; margin: 1rem 0;
} }
p { p {
margin: 0 0 1rem 0; margin: 0 0 1rem 0;
line-height: 1.5; line-height: 1.5;
&:last-child { &:last-child {
margin-bottom: 0; margin-bottom: 0;
} }
} }

View File

@ -1,11 +1,12 @@
.card { .card {
background-color: var(--surface-card); background-color: var(--surface-card);
padding: 1.5rem; padding: 1.5rem;
margin-bottom: 1rem; margin-bottom: 1rem;
border-radius: $borderRadius; border-radius: $borderRadius;
box-shadow: 0px 3px 5px rgba(0,0,0,.02), 0px 0px 2px rgba(0,0,0,.05), 0px 1px 4px rgba(0,0,0,.08) !important; box-shadow: 0px 3px 5px rgba(0, 0, 0, 0.02), 0px 0px 2px rgba(0, 0, 0, 0.05),
0px 1px 4px rgba(0, 0, 0, 0.08) !important;
&.card-w-title { &.card-w-title {
padding-bottom: 2rem; padding-bottom: 2rem;
} }
} }

Some files were not shown because too many files have changed in this diff Show More