Skip to content

Commit

Permalink
refactor: fixed packages for monorepo
Browse files Browse the repository at this point in the history
  • Loading branch information
Tolfx committed Aug 14, 2022
1 parent fe74fc3 commit dfbc53d
Show file tree
Hide file tree
Showing 105 changed files with 236 additions and 410 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ coverage
.next/
out/
build
dist

# misc
.DS_Store
Expand Down
2 changes: 1 addition & 1 deletion apps/admin/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "cpg-admin",
"name": "admin",
"version": "0.1.0",
"private": true,
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion apps/admin/src/components/customers/Create.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { currencyCodes } from "lib/Currencies";
import { currencyCodes } from "lib";
import { ArrayInput, Create, FormTab, NumberInput, PasswordInput, SelectInput, SimpleFormIterator, TabbedForm, TextInput } from "react-admin";
//@ts-ignore
import { RichTextInput } from 'ra-input-rich-text';
Expand Down
2 changes: 1 addition & 1 deletion apps/admin/src/components/customers/Edit.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { currencyCodes } from "lib/Currencies";
import { currencyCodes } from "lib";
import { Edit, FormTab, PasswordInput, AutocompleteInput, TabbedForm, TextInput, SelectInput, ArrayInput, SimpleFormIterator, NumberInput, ReferenceInput, useEditController } from "react-admin";
//@ts-ignore
import { RichTextInput } from 'ra-input-rich-text';
Expand Down
2 changes: 1 addition & 1 deletion apps/admin/src/components/invoices/Create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import
} from "react-admin";
//@ts-ignore
import { RichTextInput } from 'ra-input-rich-text';
import { currencyCodes } from "lib/Currencies";
import { currencyCodes } from "lib";
import RenderFullName from "../../lib/RenderFullName";
import { getDate } from "../../lib/dateFormat";

Expand Down
2 changes: 1 addition & 1 deletion apps/admin/src/components/invoices/Edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import
FormDataConsumer,
} from "react-admin";
import { RichTextInput } from 'ra-input-rich-text';
import { currencyCodes } from "lib/Currencies";
import { currencyCodes } from "lib";
import RenderFullName from "../../lib/RenderFullName";
import { getDate } from "../../lib/dateFormat";

Expand Down
2 changes: 1 addition & 1 deletion apps/admin/src/components/orders/Create.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { currencyCodes } from "lib/Currencies";
import { currencyCodes } from "lib";
import
{
ArrayInput,
Expand Down
2 changes: 1 addition & 1 deletion apps/admin/src/components/orders/Edit.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { currencyCodes } from "lib/Currencies";
import { currencyCodes } from "lib";
import
{
ArrayInput,
Expand Down
2 changes: 1 addition & 1 deletion apps/admin/src/components/products/Create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import
} from "react-admin";
//@ts-ignore
import { RichTextInput } from 'ra-input-rich-text';
import { currencyCodes } from "lib/Currencies";
import { currencyCodes } from "lib";

export const CreateProducts = (props: any) =>
(
Expand Down
2 changes: 1 addition & 1 deletion apps/admin/src/components/products/Edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import
} from "react-admin";
//@ts-ignore
import { RichTextInput } from 'ra-input-rich-text';
import { currencyCodes } from "lib/Currencies";
import { currencyCodes } from "lib";

export const EditProducts = (props: any) =>
(
Expand Down
2 changes: 1 addition & 1 deletion apps/admin/src/components/transactions/Create.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { currencyCodes } from "lib/Currencies";
import { currencyCodes } from "lib";
import { Create, DateInput, FormDataConsumer, FormTab, NumberInput, AutocompleteInput, TabbedForm, TextInput, SelectInput, ReferenceInput, BooleanInput } from "react-admin";
import { getDate } from "../../lib/dateFormat";
import RenderFullName from "../../lib/RenderFullName";
Expand Down
2 changes: 1 addition & 1 deletion apps/admin/src/components/transactions/Edit.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { currencyCodes } from "lib/Currencies";
import { currencyCodes } from "lib";
import { DateInput, Edit, FormDataConsumer, FormTab, NumberInput, ReferenceInput, AutocompleteInput, TabbedForm, TextInput } from "react-admin";
import RenderFullName from "../../lib/RenderFullName";

Expand Down
2 changes: 1 addition & 1 deletion apps/admin/src/inputs/CurrencyInput.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { currencyCodes } from "lib/Currencies";
import { currencyCodes } from "lib";
import { AutocompleteInput } from "react-admin";

export default function CurrencyInput()
Expand Down
5 changes: 2 additions & 3 deletions apps/api/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "cpg-api",
"name": "api",
"version": "3.4.0",
"private": true,
"description": "Central Payment Gateway",
Expand Down Expand Up @@ -65,7 +65,6 @@
"devDependencies": {
"@types/bcryptjs": "^2.4.2",
"@types/clear": "^0.1.2",
"@types/colors": "^1.2.1",
"@types/common-tags": "^1.8.1",
"@types/cors": "^2.8.12",
"@types/cron": "^1.7.3",
Expand Down Expand Up @@ -95,8 +94,8 @@
"eslint": "^8.14.0",
"eslint-config-custom": "*",
"interfaces": "*",
"tsconfig": "*",
"lib": "*",
"tsconfig": "*",
"typescript": "^4.3.5"
}
}
2 changes: 1 addition & 1 deletion apps/api/src/Admin/AdminHandler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Logger from "lib/Logger";
import { Logger } from "lib";
import chalk from "chalk";
import clear from "clear";
import figlet from "figlet";
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/Admin/Commands/Admin.prompt.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable no-case-declarations */
import Logger from "lib/Logger";
import { Logger } from "lib";
import prompt from "prompt";
import AdminModel from "../../Database/Models/Administrators.model";
import createAdmin from "../CreateAdmin";
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/Admin/Commands/Company.prompt.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable no-case-declarations */
import Logger from "lib/Logger";
import { Logger } from "lib";
import prompt from "prompt";
import { CacheConfig } from "../../Cache/Configs.cache";
import ConfigModel from "../../Database/Models/Configs.model";
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/Admin/Commands/Cron.prompt.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { cron_chargeStripePayment, cron_notifyInvoices, cron_notifyLateInvoicePaid } from "../../Cron/Methods/Invoices.cron.methods";
import { cron_createNewInvoicesFromOrders } from "../../Cron/Methods/Orders.cron.methods";
import Logger from "lib/Logger";
import { Logger } from "lib";

export default
{
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/Admin/Commands/Email.prompt.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable no-case-declarations */
import Logger from "lib/Logger";
import { Logger } from "lib";
import prompt from "prompt";
import ConfigModel from "../../Database/Models/Configs.model";

Expand Down
4 changes: 2 additions & 2 deletions apps/api/src/Admin/Commands/Invoices.prompt.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/* eslint-disable no-case-declarations */
import InvoiceModel from "../../Database/Models/Invoices.model";
import Logger from "lib/Logger";
import { Logger } from "lib";
import inquirer from 'inquirer';
import { idInvoice } from "../../Lib/Generator";
import { getDates30DaysAgo } from "../../Cron/Methods/Invoices.cron.methods";
import { A_CC_Payments } from "interfaces/types/PaymentMethod";
import { currencyCodes } from "lib/Currencies";
import { currencyCodes } from "lib";
import CustomerModel from "../../Database/Models/Customers/Customer.model";
import mainEvent from "../../Events/Main.event";
import { sendInvoiceEmail } from "../../Lib/Invoices/SendEmail";
Expand Down
4 changes: 2 additions & 2 deletions apps/api/src/Admin/Commands/Orders.prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import CustomerModel from "../../Database/Models/Customers/Customer.model";
import OrderModel from "../../Database/Models/Orders.model";
import ProductModel from "../../Database/Models/Products.model";
import PromotionCodeModel from "../../Database/Models/PromotionsCode.model";
import { currencyCodes } from "lib/Currencies";
import { currencyCodes } from "lib";
import { idOrder } from "../../Lib/Generator";
import Logger from "lib/Logger";
import { Logger } from "lib";
import { A_CC_Payments, A_RecurringMethod } from "interfaces/types/PaymentMethod";
import dateFormat from "date-and-time";
import nextRycleDate from "../../Lib/Dates/DateCycle";
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/Admin/Commands/Smtp.prompt.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable no-case-declarations */
import Logger from "lib/Logger";
import { Logger } from "lib";
import prompt from "prompt";
import { CacheConfig } from "../../Cache/Configs.cache";
import ConfigModel from "../../Database/Models/Configs.model";
Expand Down
4 changes: 2 additions & 2 deletions apps/api/src/Admin/Commands/Transaction.prompt.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import TransactionsModel from "../../Database/Models/Transactions.model";
import Logger from "lib/Logger";
import { Logger } from "lib";
import inquirer from 'inquirer';
import CustomerModel from "../../Database/Models/Customers/Customer.model";
import InvoiceModel from "../../Database/Models/Invoices.model";
import { A_CC_Payments } from "interfaces/types/PaymentMethod";
import { currencyCodes } from "lib/Currencies";
import { currencyCodes } from "lib";
import dateFormat from "date-and-time";
import mainEvent from "../../Events/Main.event";

Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/Admin/Commands/Webhook.prompt.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable no-case-declarations */
import Logger from "lib/Logger";
import { Logger } from "lib";
import prompt from "prompt";
import ConfigModel from "../../Database/Models/Configs.model";

Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/Admin/CreateAdmin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import bcrypt from "bcryptjs";
import { CacheAdmin, getAdminByUsername } from "../Cache/Admin.cache";
import AdminModel from "../Database/Models/Administrators.model";
import { idAdmin } from "../Lib/Generator";
import Logger from "lib/Logger";
import { Logger } from "lib";

export default function createAdmin(username: string, password: string)
{
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/Cache/reCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ImageModel from "../Database/Models/Images.model";
import OrderModel from "../Database/Models/Orders.model";
import ProductModel from "../Database/Models/Products.model";
import TransactionsModel from "../Database/Models/Transactions.model";
import Logger from "lib/Logger";
import { Logger } from "lib";
import { CacheAdmin } from "./Admin.cache";
import { CacheCategories } from "./Categories.cache";
import { CacheCustomer } from "./Customer.cache";
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/Cron/Invoices.cron.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CronJob } from "cron";
import Logger from "lib/Logger";
import { Logger } from "lib";
import { Default_Language } from "../Config";
import GetText from "../Translation/GetText";
import
Expand Down
4 changes: 2 additions & 2 deletions apps/api/src/Cron/Methods/Invoices.cron.methods.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Company_Name, DebugMode, Default_Language, d_Days } from "../../Config";
import InvoiceModel from "../../Database/Models/Invoices.model";
import dateFormat from "date-and-time";
import Logger from "lib/Logger";
import { Logger } from "lib";
import GetText from "../../Translation/GetText";
import CustomerModel from "../../Database/Models/Customers/Customer.model";
import { sendInvoiceEmail, sendLateInvoiceEmail } from "../../Lib/Invoices/SendEmail";
import { ChargeCustomer } from "../../Payments/Stripe";
import { InvoiceLateReport, InvoiceNotifiedReport } from "../../Email/Reports/InvoiceReport";
import { convertCurrency } from "lib/Currencies";
import { convertCurrency } from "lib";
import { getInvoiceByIdAndMarkAsPaid } from "../../Lib/Invoices/MarkAsPaid";
import sendEmailOnTransactionCreation from "../../Lib/Transaction/SendEmailOnCreation";
import createCredit from "../../Lib/Customers/createCredit";
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/Cron/Methods/Orders.cron.methods.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Default_Language, d_Days } from "../../Config";
import OrderModel from "../../Database/Models/Orders.model";
import Logger from "lib/Logger";
import { Logger } from "lib";
import GetText from "../../Translation/GetText";
import dateFormat from "date-and-time";
import nextRecycleDate from "../../Lib/Dates/DateCycle";
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/Database/GraphQL/ApolloServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import SchemaPoser from './SchemaPoser';
import jwt from "jsonwebtoken";
import bcrypt from "bcryptjs";
import { CacheAdmin, getAdminByUsername } from '../../Cache/Admin.cache';
import Logger from 'lib/Logger';
import { Logger } from "lib";
import { Application } from "express";
import GetText from '../../Translation/GetText';

Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/Database/GraphQL/ResolverAccess.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Resolver } from "graphql-compose";
import Logger from "lib/Logger";
import { Logger } from "lib";
import GetText from "../../Translation/GetText";

export function resolverAdminAccess(resolvers: {
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/Database/GraphQL/SchemaPoser.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { SchemaComposer } from 'graphql-compose';
import fs from "fs";
import { HomeDir } from '../../Config';
import Logger from 'lib/Logger';
import { Logger } from "lib";
import GetText from '../../Translation/GetText';

const schemaComposer = new SchemaComposer();
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/Database/Models/Category.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ICategory } from "interfaces/Categories.interface";
import mongoose, { model, Schema } from "mongoose"
import increment from "mongoose-auto-increment";
import { Default_Language, MongoDB_URI } from "../../Config";
import Logger from "lib/Logger";
import { Logger } from "lib";
import GetText from "../../Translation/GetText";

const CategorySchema = new Schema
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/Database/Models/ConfigurableOptions.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import mongoose, { model, Schema, Document } from "mongoose"
import increment from "mongoose-auto-increment";
import { Default_Language, MongoDB_URI } from "../../Config";
import { IConfigurableOptions } from "interfaces/ConfigurableOptions.interface";
import Logger from "lib/Logger";
import { Logger } from "lib";
import GetText from "../../Translation/GetText";

const ConfigurableOptionsSchema = new Schema
Expand Down
4 changes: 2 additions & 2 deletions apps/api/src/Database/Models/Customers/Customer.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import mongoose, { Document, model, Schema } from "mongoose"
import increment from "mongoose-auto-increment";
import { Default_Language, MongoDB_URI } from "../../../Config";
import { ICustomer, ICustomerMethods } from "interfaces/Customer.interface";
import Logger from "lib/Logger";
import { Logger } from "lib";
import GetText from "../../../Translation/GetText";
import { currencyCodes } from "lib/Currencies";
import { currencyCodes } from "lib";

const CustomerSchema = new Schema
(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Document, model, Schema } from "mongoose"
import Logger from "lib/Logger";
import { Logger } from "lib";

const PasswordResetSchema = new Schema
(
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/Database/Models/Images.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import mongoose, { Document, model, Schema } from "mongoose"
import increment from "mongoose-auto-increment";
import { Default_Language, MongoDB_URI } from "../../Config";
import { IImage } from "interfaces/Images.interface";
import Logger from "lib/Logger";
import { Logger } from "lib";
import GetText from "../../Translation/GetText";

const ImageSchema = new Schema
Expand Down
4 changes: 2 additions & 2 deletions apps/api/src/Database/Models/Invoices.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import mongoose, { Document, model, Schema } from "mongoose"
import increment from "mongoose-auto-increment";
import { Default_Language, MongoDB_URI } from "../../Config";
import { extendedOrderStatus, IInvoice, IInvoiceMethods } from "interfaces/Invoice.interface";
import Logger from "lib/Logger";
import { Logger } from "lib";
import GetText from "../../Translation/GetText";
import { currencyCodes, GetCurrencySymbol } from "lib/Currencies";
import { currencyCodes, GetCurrencySymbol } from "lib";

export const A_InvoiceStatus: extendedOrderStatus[] = [
"active",
Expand Down
4 changes: 2 additions & 2 deletions apps/api/src/Database/Models/Orders.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import mongoose, { Document, model, Schema } from "mongoose"
import increment from "mongoose-auto-increment";
import { Default_Language, MongoDB_URI } from "../../Config";
import { IOrder } from "interfaces/Orders.interface";
import Logger from "lib/Logger";
import { Logger } from "lib";
import GetText from "../../Translation/GetText";
import { A_CC_Payments, A_RecurringMethod } from "interfaces/types/PaymentMethod";
import { currencyCodes } from "lib/Currencies";
import { currencyCodes } from "lib";
import { A_PaymentTypes } from "interfaces/types/PaymentTypes";


Expand Down
4 changes: 2 additions & 2 deletions apps/api/src/Database/Models/Products.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import mongoose, { Document, model, Schema } from "mongoose"
import increment from "mongoose-auto-increment";
import { Default_Language, MongoDB_URI } from "../../Config";
import { IProduct } from "interfaces/Products.interface";
import Logger from "lib/Logger";
import { Logger } from "lib";
import GetText from "../../Translation/GetText";
import { A_RecurringMethod } from "interfaces/types/PaymentMethod";
import { A_PaymentTypes } from "interfaces/types/PaymentTypes";
import { currencyCodes } from "lib/Currencies";
import { currencyCodes } from "lib";


const ProductSchema = new Schema
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/Database/Models/PromotionsCode.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import mongoose, { Document, model, Schema } from "mongoose"
import increment from "mongoose-auto-increment";
import { Default_Language, MongoDB_URI } from "../../Config";
import { IPromotionsCodes } from "interfaces/PromotionsCodes.interface";
import Logger from "lib/Logger";
import { Logger } from "lib";
import GetText from "../../Translation/GetText";

const PromotionCodeSchema = new Schema
Expand Down
4 changes: 2 additions & 2 deletions apps/api/src/Database/Models/Quotes.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import mongoose, { Document, model, Schema } from "mongoose"
import increment from "mongoose-auto-increment";
import { Default_Language, MongoDB_URI } from "../../Config";
import { IQuotes } from "interfaces/Quotes.interface";
import Logger from "lib/Logger";
import { Logger } from "lib";
import GetText from "../../Translation/GetText";
import { A_CC_Payments } from "interfaces/types/PaymentMethod";
import { currencyCodes } from "lib/Currencies";
import { currencyCodes } from "lib";

const QuotesSchema = new Schema
(
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/Database/Models/Subscriptions.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import increment from "mongoose-auto-increment";
import { MongoDB_URI } from "../../Config";
import { IQuotes } from "interfaces/Quotes.interface";
import { ISubscription } from "interfaces/Subscriptions.interface";
import Logger from "lib/Logger";
import { Logger } from "lib";
import GetText from "../../Translation/GetText";
import { A_RecurringMethod } from "interfaces/types/PaymentMethod";
import { A_InvoiceStatus } from "./Invoices.model";
Expand Down
Loading

0 comments on commit dfbc53d

Please sign in to comment.