Skip to content

Commit

Permalink
Fix building issues, organize imports
Browse files Browse the repository at this point in the history
  • Loading branch information
MrBartusek committed Nov 22, 2023
1 parent 04a8aa2 commit a00b003
Show file tree
Hide file tree
Showing 43 changed files with 114 additions and 136 deletions.
12 changes: 6 additions & 6 deletions apps/api/src/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { MongooseModule } from '@nestjs/mongoose';
import { ServeStaticModule } from '@nestjs/serve-static';
import { join } from 'path';
import { ProductsModule } from './models/products/products.module';
import { MongooseModule } from '@nestjs/mongoose';
import { UsersModule } from './models/users/users.module';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { AuthModule } from './auth/auth.module';
import { InventoryModule } from './models/inventory/inventory.module';
import { OrganizationsModule } from './models/organizations/organizations.module';
import { ProductsModule } from './models/products/products.module';
import { UsersModule } from './models/users/users.module';
import { WarehousesModule } from './models/warehouses/warehouses.module';
import { InventoryModule } from './models/inventory/inventory.module';

const FrontendModule = ServeStaticModule.forRoot({
rootPath: join(__dirname, '../..', 'client', 'dist'),
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/database/entity.repository.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Document, Model, FilterQuery, UpdateQuery } from 'mongoose';
import * as mongoose from 'mongoose';
import { Document, FilterQuery, Model, UpdateQuery } from 'mongoose';

const DEFAULT_PROJECTIONS = {
__v: 0,
Expand Down
8 changes: 4 additions & 4 deletions apps/api/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { INestApplication, ValidationPipe } from '@nestjs/common';
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
import { INestApplication, ValidationPipe } from '@nestjs/common';
import RedisStore from 'connect-redis';
import * as session from 'express-session';
import * as passport from 'passport';
import Utils from './utils';
import RedisStore from 'connect-redis';
import { AppModule } from './app.module';
import redisClient from './redis';
import Utils from './utils';

async function bootstrap() {
const app = await NestFactory.create(AppModule);
Expand Down
22 changes: 11 additions & 11 deletions apps/api/src/models/inventory/inventory.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ import { InventoryController } from './inventory.controller';
import { InventoryService } from './inventory.service';

describe('InventoryController', () => {
let controller: InventoryController;
let controller: InventoryController;

beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
controllers: [InventoryController],
providers: [InventoryService],
}).compile();
beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
controllers: [InventoryController],
providers: [InventoryService],
}).compile();

controller = module.get<InventoryController>(InventoryController);
});
controller = module.get<InventoryController>(InventoryController);
});

it('should be defined', () => {
expect(controller).toBeDefined();
});
it('should be defined', () => {
expect(controller).toBeDefined();
});
});
4 changes: 2 additions & 2 deletions apps/api/src/models/inventory/inventory.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import { Types } from 'mongoose';
import { AddInventoryItemDto, BasicInventoryItemDto, InventoryItemDto } from 'shared-types';
import { AuthenticatedGuard } from '../../auth/guards/authenticated.guard';
import { ParseObjectIdPipe } from '../../pipes/prase-object-id.pipe';
import { ProductsService } from '../products/products.service';
import { WarehousesService } from '../warehouses/warehouses.service';
import { InventoryService } from './inventory.service';
import { InventoryItem } from './schemas/inventory-item.schema';
import { WarehousesService } from '../warehouses/warehouses.service';
import { ProductsService } from '../products/products.service';

@ApiTags('inventory')
@UseGuards(AuthenticatedGuard)
Expand Down
8 changes: 4 additions & 4 deletions apps/api/src/models/inventory/inventory.module.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Module } from '@nestjs/common';
import { InventoryService } from './inventory.service';
import { InventoryController } from './inventory.controller';
import { MongooseModule } from '@nestjs/mongoose';
import { InventoryItem, InventoryItemSchema } from './schemas/inventory-item.schema';
import { InventoryRepository } from './inventory.repository';
import { ProductsModule } from '../products/products.module';
import { WarehousesModule } from '../warehouses/warehouses.module';
import { InventoryController } from './inventory.controller';
import { InventoryRepository } from './inventory.repository';
import { InventoryService } from './inventory.service';
import { InventoryItem, InventoryItemSchema } from './schemas/inventory-item.schema';

@Module({
imports: [
Expand Down
5 changes: 2 additions & 3 deletions apps/api/src/models/inventory/inventory.service.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { Injectable } from '@nestjs/common';
import { Types } from 'mongoose';
import { FilterQuery, Types } from 'mongoose';
import { AddInventoryItemDto } from 'shared-types';
import { InventoryRepository } from './inventory.repository';
import { InventoryItemDocument } from './schemas/inventory-item.schema';
import { FilterQuery } from 'mongoose';
import { AddInventoryItemDto } from 'shared-types';

@Injectable()
export class InventoryService {
Expand Down
6 changes: 3 additions & 3 deletions apps/api/src/models/organizations/organizations.module.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Module } from '@nestjs/common';
import { OrganizationsService } from './organizations.service';
import { MongooseModule } from '@nestjs/mongoose';
import { WarehousesModule } from '../warehouses/warehouses.module';
import { OrganizationsController } from './organizations.controller';
import { OrganizationRepository } from './organizations.repository';
import { OrganizationsService } from './organizations.service';
import { Organization, OrganizationSchema } from './schemas/organization.schema';
import { MongooseModule } from '@nestjs/mongoose';
import { WarehousesModule } from '../warehouses/warehouses.module';

@Module({
imports: [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { HydratedDocument } from 'mongoose';
import * as mongoose from 'mongoose';
import { HydratedDocument } from 'mongoose';
import { Warehouse } from '../../warehouses/schemas/warehouse.schema';

export type OrgWarehouseReferenceDocument = HydratedDocument<OrgWarehouseReference>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { HydratedDocument } from 'mongoose';
import { OrganizationDto } from 'shared-types';
import { OrgAcl, OrgAclSchema } from './org-acl';
import { OrgStats, OrgStatsSchema } from './org-stats';
import {
OrgWarehouseReference,
OrgWarehouseReferenceSchema,
} from './org-warehouse-reference.schema';
import { OrgAcl, OrgAclSchema } from './org-acl';
import { OrganizationDto } from 'shared-types';
import { OrgStats, OrgStatsSchema } from './org-stats';

export type OrganizationDocument = HydratedDocument<Organization>;

Expand Down
6 changes: 3 additions & 3 deletions apps/api/src/models/products/products.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import {
ValidationPipe,
} from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger';
import { ProductsService } from './products.service';
import { Product } from './schemas/product.schema';
import mongoose from 'mongoose';
import { BasicProductDto, CreateProductDto, ProductDto } from 'shared-types';
import { AuthenticatedGuard } from '../../auth/guards/authenticated.guard';
import mongoose from 'mongoose';
import { OrganizationsService } from '../organizations/organizations.service';
import { ProductsService } from './products.service';
import { Product } from './schemas/product.schema';

@ApiTags('products')
@Controller('products')
Expand Down
6 changes: 3 additions & 3 deletions apps/api/src/models/products/products.module.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Module } from '@nestjs/common';
import { ProductsService } from './products.service';
import { ProductsController } from './products.controller';
import { MongooseModule } from '@nestjs/mongoose';
import { OrganizationsModule } from '../organizations/organizations.module';
import { ProductsController } from './products.controller';
import { ProductsRepository } from './products.repository';
import { ProductsService } from './products.service';
import { Product, ProductSchema } from './schemas/product.schema';
import { OrganizationsModule } from '../organizations/organizations.module';

@Module({
imports: [
Expand Down
5 changes: 2 additions & 3 deletions apps/api/src/models/products/products.service.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { Injectable } from '@nestjs/common';
import mongoose, { Types } from 'mongoose';
import { CreateProductDto } from 'shared-types';
import { ProductsRepository } from './products.repository';
import mongoose from 'mongoose';
import { ProductDocument } from './schemas/product.schema';
import { CreateProductDto } from 'shared-types';
import { Types } from 'mongoose';

@Injectable()
export class ProductsService {
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/models/products/schemas/product.schema.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import mongoose, { HydratedDocument } from 'mongoose';
import { Organization } from '../../organizations/schemas/organization.schema';
import { BasicProductDto, ProductDto } from 'shared-types';
import { Organization } from '../../organizations/schemas/organization.schema';

export type ProductDocument = HydratedDocument<Product>;

Expand Down
4 changes: 2 additions & 2 deletions apps/api/src/models/users/schemas/user.schema.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { HydratedDocument } from 'mongoose';
import { UserProfile } from './profile.schema copy';
import { UserAuth } from './auth.schema';
import { PrivateUserDto, UserDto } from 'shared-types';
import { UserAuth } from './auth.schema';
import { UserProfile } from './profile.schema copy';

export type UserDocument = HydratedDocument<User>;

Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/pipes/prase-object-id.pipe.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PipeTransform, Injectable, ArgumentMetadata, BadRequestException } from '@nestjs/common';
import { ArgumentMetadata, BadRequestException, Injectable, PipeTransform } from '@nestjs/common';
import { Types } from 'mongoose';

@Injectable()
Expand Down
2 changes: 1 addition & 1 deletion apps/api/test/app.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Test, TestingModule } from '@nestjs/testing';
import { INestApplication } from '@nestjs/common';
import { Test, TestingModule } from '@nestjs/testing';
import * as request from 'supertest';
import { AppModule } from './../src/app.module';

Expand Down
1 change: 0 additions & 1 deletion apps/client/src/components/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import classNames from 'classnames';
import React from 'react';
import { IconType } from 'react-icons';

type HTMLButtonProps = React.DetailedHTMLProps<
React.ButtonHTMLAttributes<HTMLButtonElement>,
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/components/Dropdown/DropdownMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import classNames from 'classnames';
import { useContext } from 'react';
import { DropdownContext } from './Dropdown';
import classNames from 'classnames';

type DivProps = React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;

Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/components/Errors/ApplicationError.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useRouteError } from 'react-router-dom';
import FullFocusContainer from '../FullFocusContainer';
import NotFound from './NotFound';
import Default from './Default';
import NotFound from './NotFound';

function ApplicationError() {
const error = useRouteError() as any;
Expand Down
4 changes: 2 additions & 2 deletions apps/client/src/components/Errors/NotFound.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import SideBySideImage from '../SideBySideImage';
import UndrawNotFound from '../../assets/undraw_not_found.svg';
import { useNavigate } from 'react-router-dom';
import UndrawNotFound from '../../assets/undraw_not_found.svg';
import Button from '../Button';
import SideBySideImage from '../SideBySideImage';

function NotFound() {
const navigate = useNavigate();
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/components/Form/FancyInput.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import classNames from 'classnames';
import React, { useState, forwardRef, useEffect } from 'react';
import React, { forwardRef, useEffect, useState } from 'react';
import { IconType } from 'react-icons';

type InputProps = React.DetailedHTMLProps<
Expand Down
4 changes: 2 additions & 2 deletions apps/client/src/components/IconButton.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { IconType } from 'react-icons';
import Button, { ButtonProps } from './Button';
import classNames from 'classnames';
import React from 'react';
import { IconType } from 'react-icons';
import { BsPlusCircle } from 'react-icons/bs';
import Button, { ButtonProps } from './Button';

export interface IconButtonProps extends ButtonProps {
icon?: IconType;
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/components/InventoryAddForm.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import classNames from 'classnames';
import { useContext, useEffect, useState } from 'react';
import { useForm } from 'react-hook-form';
import toast from 'react-hot-toast';
Expand All @@ -10,7 +11,6 @@ import Button from './Button';
import { CurrentAppContext } from './Context/CurrentAppContext';
import FormError from './Form/FormError';
import FormInput from './Form/FormInput';
import classNames from 'classnames';

type Inputs = {
quantity: number;
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/components/InventoryItemActions.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useContext } from 'react';
import { BsInfoCircleFill, BsPencilFill, BsTrashFill } from 'react-icons/bs';
import { useNavigate } from 'react-router-dom';
import { BasicInventoryItemDto, BasicProductDto } from 'shared-types';
import { BasicInventoryItemDto } from 'shared-types';
import ActionButton from './ActionButton';
import { CurrentAppContext } from './Context/CurrentAppContext';
import TableActionsWrapper from './TableActionsWrapper';
Expand Down
6 changes: 2 additions & 4 deletions apps/client/src/components/LoginForm.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { useState } from 'react';
import { useForm } from 'react-hook-form';
import { BsPerson, BsShieldLock } from 'react-icons/bs';
import { Link, useNavigate } from 'react-router-dom';
import { UserLoginDto } from 'shared-types';
import { HTTPResponseError, Utils } from '../utils';
import Alert from './Alert';
import Button from './Button';
import TextInput from './Form/FancyInput';
import { useContext, useState } from 'react';
import { UserContext } from './Context/UserContext';
import FormError from './Form/FormError';
import Alert from './Alert';

type Inputs = {
username: string;
Expand Down
15 changes: 8 additions & 7 deletions apps/client/src/components/OrganizationActions.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import React, { useContext } from 'react';
import { BsGear, BsInfoCircleFill, BsPencilFill, BsSliders, BsTrashFill } from 'react-icons/bs';
import { useNavigate } from 'react-router-dom';
import { BasicProductDto, OrganizationDto } from 'shared-types';
import { BsSliders } from 'react-icons/bs';
import { OrganizationDto } from 'shared-types';
import ActionButton from './ActionButton';
import { CurrentAppContext } from './Context/CurrentAppContext';
import TableActionsWrapper from './TableActionsWrapper';
import { Link } from 'react-router-dom';

export interface OrganizationSettingsButtonProps {
organization: OrganizationDto;
}

function OrganizationSettingsButton({ organization }: OrganizationSettingsButtonProps) {
return <ActionButton icon={BsSliders} />;
return (
<Link to={organization.id + '/settings'}>
<ActionButton icon={BsSliders} />
</Link>
);
}
export default OrganizationSettingsButton;
8 changes: 3 additions & 5 deletions apps/client/src/components/Pages/DashboardHomePage.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { useContext } from 'react';
import { Utils } from '../../utils';
import BigNumberCard from '../BigNumberCard';
import DashboardContent from '../DashboardContent';
import humanFormat from 'human-format';
import { CurrentAppContext } from '../Context/CurrentAppContext';
import Card from '../Card';
import TotalSoldChart from '../TotalSoldChart';
import { Utils } from '../../utils';
import { CurrentAppContext } from '../Context/CurrentAppContext';
import DashboardContent from '../DashboardContent';

function DashboardHomePage() {
const { organization } = useContext(CurrentAppContext);
Expand Down
6 changes: 3 additions & 3 deletions apps/client/src/components/Pages/DashboardPage.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Outlet } from 'react-router-dom';
import Sidebar from '../Sidebar/Sidebar';
import { CurrentAppContext } from '../Context/CurrentAppContext';
import useCurrentAppContext from '../../useAppContext';
import usePageInfo from '../../hooks/usePageInfo';
import useCurrentAppContext from '../../useAppContext';
import { CurrentAppContext } from '../Context/CurrentAppContext';
import Loader from '../Loader';
import Sidebar from '../Sidebar/Sidebar';

function DashboardPage() {
const { warehouseId, organizationId } = usePageInfo();
Expand Down
8 changes: 4 additions & 4 deletions apps/client/src/components/Pages/InventoryAddPage.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Link } from 'react-router-dom';
import TableTopBar from '../TableTopBar';
import IconButton from '../IconButton';
import { BsChevronLeft } from 'react-icons/bs';
import { useContext } from 'react';
import { BsChevronLeft } from 'react-icons/bs';
import { Link } from 'react-router-dom';
import { CurrentAppContext } from '../Context/CurrentAppContext';
import IconButton from '../IconButton';
import InventoryAddForm from '../InventoryAddForm';
import TableTopBar from '../TableTopBar';

function InventoryAddPage() {
const appContext = useContext(CurrentAppContext);
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/components/Pages/InventoryListPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { Link } from 'react-router-dom';
import useInventoryList from '../../hooks/useInventoryList';
import { CurrentAppContext } from '../Context/CurrentAppContext';
import IconButton from '../IconButton';
import InventoryTable from '../InventoryTable';
import Loader from '../Loader';
import TableTopBar from '../TableTopBar';
import InventoryTable from '../InventoryTable';

function InventoryListPage() {
const appContext = useContext(CurrentAppContext);
Expand Down
Loading

0 comments on commit a00b003

Please sign in to comment.