Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore/packages update #1

Merged
merged 4 commits into from Jan 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions .husky/pre-commit
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn affected:lint --fix && yarn affected:build
4 changes: 2 additions & 2 deletions apps/backend/src/auth/header-api-key.strategy.ts
Expand Up @@ -16,9 +16,9 @@ export class HeaderApiKeyStrategy extends PassportStrategy(Strategy, 'api-key')
});
}

public validate = (apiKey: string, done: (error: Error, data) => {}) => {
public validate = (apiKey: string, done: (error: Error, data) => Record<string, unknown>) => {
const keyExpected = this.configService.get<string>('API_KEY');
if (this.configService.get<string>('API_KEY') === apiKey) {
if (keyExpected === apiKey) {
done(null, true);
}

Expand Down
Expand Up @@ -3,7 +3,6 @@ import { ApiProperty, ApiPropertyOptional, OmitType } from '@nestjs/swagger';
import {
IsInt,
IsISO8601,
IsNotEmpty,
IsNumberString,
IsOptional,
IsString,
Expand Down
3 changes: 0 additions & 3 deletions apps/backend/src/files/files.service.ts
@@ -1,13 +1,10 @@
import { Injectable } from '@nestjs/common';
import { Express } from 'express';
// This is a hack to make Multer available in the Express namespace
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { Multer } from 'multer';
import { PrismaService } from "../prisma/prisma.service";
import { FileMetadataDto } from "./dto/file-metadata.dto";
import { UpdateFileMetadataDto } from "./dto/update-file-metadata.dto";
import { Simulate } from "react-dom/test-utils";
import select = Simulate.select;

@Injectable()
export class FilesService {
Expand Down
1 change: 0 additions & 1 deletion apps/backend/src/main.ts
Expand Up @@ -12,7 +12,6 @@ import { intersection } from 'lodash';
import { SwaggerModule } from "@nestjs/swagger";
import { getSwaggerDocumentationConfig } from "./swagger/SwaggerDocumentConfig";
import { PrismaClientExceptionFilter } from "./exception-filters/PrismaClientExceptionFilter";
import { NoDataInterceptor } from "./interceptors/NoDataInterceptor";

const logger = new Logger('bootstrap', { timestamp: true });

Expand Down
17 changes: 9 additions & 8 deletions apps/backend/src/orders/dto/create-order-item-timeframe.dto.ts
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { ApiProperty } from "@nestjs/swagger";
import {
IsInt,
Expand Down Expand Up @@ -32,14 +33,14 @@ export class CreateOrderItemTimeframeDto {
}

function IsStartOfDay(validationOptions?: ValidationOptions) {
return function (object: Object, propertyName: string) {
return function (object: Record<string, any>, propertyName: string) {
registerDecorator({
name: "IsStartOfDay",
target: object.constructor,
propertyName: propertyName,
options: validationOptions,
validator: {
validate(value: any, validationArguments?: ValidationArguments): boolean {
validate(value: string | number | Date): boolean {
return new Date(value).getUTCMilliseconds() === 0;
},
defaultMessage(): string {
Expand All @@ -51,14 +52,14 @@ function IsStartOfDay(validationOptions?: ValidationOptions) {
}

function IsEndOfDay(validationOptions?: ValidationOptions) {
return function (object: Object, propertyName: string) {
return function (object: Record<string, any>, propertyName: string) {
registerDecorator({
name: "IsEndOfDay",
target: object.constructor,
propertyName: propertyName,
options: validationOptions,
validator: {
validate(value: any, validationArguments?: ValidationArguments): boolean {
validate(value: string | number | Date): boolean {
return new Date(value).getUTCMilliseconds() === 999;
},
defaultMessage(): string {
Expand All @@ -70,15 +71,15 @@ function IsEndOfDay(validationOptions?: ValidationOptions) {
}

function IsGreaterThan(property: string, validationOptions?: ValidationOptions) {
return function (object: Object, propertyName: string) {
return function (object: Record<string, any>, propertyName: string) {
registerDecorator({
name: "IsGreaterThan",
target: object.constructor,
propertyName: propertyName,
constraints: [property],
options: validationOptions,
validator: {
validate(value: any, args: ValidationArguments) {
validate(value: string | number | Date, args: ValidationArguments) {
const [relatedPropertyName] = args.constraints;
const relatedValue = args.object[relatedPropertyName];
return value > relatedValue;
Expand All @@ -92,15 +93,15 @@ function IsGreaterThan(property: string, validationOptions?: ValidationOptions)
}

function IsTheSameYearAs(property: string, validationOptions?: ValidationOptions) {
return function (object: Object, propertyName: string) {
return function (object: Record<string, any>, propertyName: string) {
registerDecorator({
name: "IsTheSameYearAs",
target: object.constructor,
propertyName: propertyName,
constraints: [property],
options: validationOptions,
validator: {
validate(value: any, args: ValidationArguments) {
validate(value: string | number | Date, args: ValidationArguments) {
const [relatedPropertyName] = args.constraints;
const relatedValue = args.object[relatedPropertyName];
return new Date(value).getUTCFullYear() === new Date(relatedValue).getUTCFullYear();
Expand Down
10 changes: 5 additions & 5 deletions apps/backend/src/orders/dto/create-order-item.dto.ts
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import {
ArrayMinSize,
Expand All @@ -8,7 +9,6 @@ import {
IsString,
registerDecorator,
ValidateNested,
ValidationArguments,
ValidationOptions
} from "class-validator";
import { Countries } from "@energyweb/utils-general";
Expand Down Expand Up @@ -41,14 +41,14 @@ export class CreateOrderItemDto {
}

function TimeframesInSequence(validationOptions?: ValidationOptions) {
return function (object: Object, propertyName: string) {
return function (object: Record<string, any>, propertyName: string) {
registerDecorator({
name: "TimeframesInSequence",
target: object.constructor,
propertyName: propertyName,
options: validationOptions,
validator: {
validate(value: any, args: ValidationArguments) {
validate(value: any) {
if (value.length < 2) {
return true;
}
Expand All @@ -67,14 +67,14 @@ function TimeframesInSequence(validationOptions?: ValidationOptions) {
}

function AdjacentTimeframes(validationOptions?: ValidationOptions) {
return function (object: Object, propertyName: string) {
return function (object: Record<string, any>, propertyName: string) {
registerDecorator({
name: "AdjacentTimeframes",
target: object.constructor,
propertyName: propertyName,
options: validationOptions,
validator: {
validate(value: any, validationArguments?: ValidationArguments): boolean {
validate(value: Array<{start: string | number | Date, end: string | number | Date}>): boolean {
if (value.length < 2) {
return true;
}
Expand Down
5 changes: 2 additions & 3 deletions apps/backend/src/orders/orders.controller.ts
Expand Up @@ -15,7 +15,6 @@ import {
} from '@nestjs/common';
import { OrdersService } from './orders.service';
import { CreateOrderDto } from './dto/create-order.dto';
import { UpdateOrderDto } from './dto/update-order.dto';
import { ApiCreatedResponse, ApiOkResponse, ApiTags } from "@nestjs/swagger";
import { OrderDto } from "./dto/order.dto";
import { NoDataInterceptor } from "../interceptors/NoDataInterceptor";
Expand Down Expand Up @@ -56,8 +55,8 @@ export class OrdersController {
}

@Patch(':id')
update(@Param('id') id: string, @Body() updateOrderDto: UpdateOrderDto) {
return this.ordersService.update(+id, updateOrderDto);
update(@Param('id') id: string) {
return this.ordersService.update(+id);
}

@Delete(':id')
Expand Down
3 changes: 1 addition & 2 deletions apps/backend/src/orders/orders.service.ts
@@ -1,6 +1,5 @@
import { ForbiddenException, Injectable, Logger, NotFoundException } from '@nestjs/common';
import { CreateOrderDto } from './dto/create-order.dto';
import { UpdateOrderDto } from './dto/update-order.dto';
import { PrismaService } from '../prisma/prisma.service';
import { OrderDto } from './dto/order.dto';
import { OrderItemDto } from './dto/order-item.dto';
Expand Down Expand Up @@ -101,7 +100,7 @@ export class OrdersService {
});
}

update(id: number, updateOrderDto: UpdateOrderDto) {
update(id: number) {
return `This action updates a #${id} order`;
}

Expand Down
2 changes: 1 addition & 1 deletion apps/backend/src/sellers/dto/update-seller.dto.ts
@@ -1,4 +1,4 @@
import { PartialType, OmitType } from '@nestjs/swagger';
import { PartialType } from '@nestjs/swagger';
import { CreateSellerDto } from './create-seller.dto';

export class UpdateSellerDto extends PartialType(CreateSellerDto) {}
2 changes: 1 addition & 1 deletion apps/backend/tsconfig.app.json
Expand Up @@ -8,6 +8,6 @@
"emitDecoratorMetadata": true,
"target": "es2015"
},
"exclude": ["**/*.spec.ts"],
"exclude": ["**/*.spec.ts", "**/*.test.ts"],
"include": ["**/*.ts"]
}
2 changes: 1 addition & 1 deletion apps/backend/tsconfig.spec.json
Expand Up @@ -5,5 +5,5 @@
"module": "commonjs",
"types": ["jest", "node"]
},
"include": ["**/*.spec.ts", "**/*.d.ts"]
"include": ["**/*.spec.ts", "**/*.test.ts", "**/*.d.ts"]
}
17 changes: 0 additions & 17 deletions apps/frontend-e2e/.eslintrc.json

This file was deleted.

12 changes: 0 additions & 12 deletions apps/frontend-e2e/cypress.json

This file was deleted.

4 changes: 0 additions & 4 deletions apps/frontend-e2e/src/fixtures/example.json

This file was deleted.

13 changes: 0 additions & 13 deletions apps/frontend-e2e/src/integration/app.spec.ts

This file was deleted.

20 changes: 0 additions & 20 deletions apps/frontend-e2e/src/plugins/index.js

This file was deleted.

1 change: 0 additions & 1 deletion apps/frontend-e2e/src/support/app.po.ts

This file was deleted.

33 changes: 0 additions & 33 deletions apps/frontend-e2e/src/support/commands.ts

This file was deleted.

17 changes: 0 additions & 17 deletions apps/frontend-e2e/src/support/index.ts

This file was deleted.

10 changes: 0 additions & 10 deletions apps/frontend-e2e/tsconfig.e2e.json

This file was deleted.

10 changes: 0 additions & 10 deletions apps/frontend-e2e/tsconfig.json

This file was deleted.

8 changes: 4 additions & 4 deletions apps/frontend/src/components/CardReadMore/CardReadMore.tsx
Expand Up @@ -9,13 +9,13 @@ import {
ListItemIcon,
ListItemText,
Typography,
} from '@material-ui/core';
Box
} from '@mui/material';
import React from 'react';
import { Box } from '@material-ui/system';
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
import KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp';
import { variables } from '@energyweb/zero-protocol-labs-theme';
import FilcoinLogo from '../../assets/svg/filecoinLogo.svg';
import KeyboardArrowDownIcon from '@material-ui/icons/KeyboardArrowDown';
import KeyboardArrowUpIcon from '@material-ui/icons/KeyboardArrowUp';
import { ReactComponent as Vector } from '../../assets/svg/vector-line.svg';
import { ReactComponent as People } from '../../assets/svg/people.svg';
import { useStyles } from './СardReadMore.styles';
Expand Down
@@ -1,5 +1,5 @@
import styled from "@emotion/styled";
import { Box } from "@material-ui/core"
import { Box } from "@mui/material"
import { useState } from "react";
import { ReactComponent as Chat } from '../../assets/svg/Chat.svg';
import CardReadMore from "./CardReadMore";
Expand Down