Skip to content

Commit

Permalink
Merge pull request #77 from Tolfix/QtKaii-deepsource_config
Browse files Browse the repository at this point in the history
Create .deepsource.toml
  • Loading branch information
Tolfx authored Oct 11, 2022
2 parents 0e861be + a8807d5 commit 297e142
Show file tree
Hide file tree
Showing 51 changed files with 1,277 additions and 92 deletions.
12 changes: 12 additions & 0 deletions .deepsource.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version = 1

[[analyzers]]
name = "shell"
enabled = true

[[analyzers]]
name = "javascript"
enabled = true

[analyzers.meta]
plugins = ["react"]
15 changes: 6 additions & 9 deletions .github/workflows/docker-admin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,15 @@ name: Docker Image - Admin
on:
push:
paths:
- 'apps/admin/src/**'
- 'apps/admin/public/**'
- 'apps/admin/package.json'
- 'Dockerfile_ADMIN'
- "apps/admin/src/**"
- "apps/admin/public/**"
- "apps/admin/package.json"
- "apps/admin/Dockerfile"
branches:
- master


jobs:

build:

runs-on: ubuntu-latest

steps:
Expand All @@ -26,6 +23,6 @@ jobs:
run: |
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
- name: Build the Docker image
run: docker build . --file Dockerfile_ADMIN --tag tolfixorg/cpg-admin:latest
run: docker build . --file ./apps/admin/Dockerfile --tag tolfixorg/cpg-admin:latest
- name: Docker push
run: docker push tolfixorg/cpg-admin:latest
run: docker push tolfixorg/cpg-admin:latest
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,40 @@
<strong>C</strong>entral <strong>P</strong>ayment <strong>G</strong>ateway
</div>


# ⭐ | CPG

CPG is being used to create items, generate invoices, handle orders, view transactions, and ensure payments make it to the client to develop your business. It offers many approaches for developers to personalize CPG

# Making domain package

1. Copy `dummy` folder and paste in `packages` folder
2. Rename with the format: `cpg-{package_name}`
3. In `package.json` replace name with: `@cpg/{package_name}`
4. Install dependencies in root with `npm i` (To sync with node_modules too)
5. Makes changes and once done run with `npm run build -w=cpg/{package_name}`

### Installing domain package to apps

1. Go to app and to `package.json`
2. Decide if it goes to dev or not
3. Add a new line with the following: `"@cpg/{package_name}": "*"` (Star is needed)
4. Go to root and run: `npm i`.

This should install the dependency

# 📢 | Contribute

Want to contribute? Great!
You can contribute to the repository by `forking`, then make a pull request when you're done!
Remember to read our [CONTRIBUTING](https://github.com/Tolfix/cpg/blob/master/CONTRIBUTING.md) guidelines to ensure your `PR` gets accepted.
Or you can ask on our [`discord server`](https://discord.tolfix.com).

# 🔮 | Discord

[![Discord](https://discord.com/api/guilds/833438897484595230/widget.png?style=banner4)](https://discord.tolfix.com)

# ⚙ | Tolfix

**Tolfix** is a `company` focused on `IT`, `Development` and `Networking`,
we strive to help others with their `IT` issues and love contributing to other peoples projects!
If you'd like to find out more, you can visit us at [`https://tolfix.com/`](https://tolfix.com/).
19 changes: 7 additions & 12 deletions Dockerfile_ADMIN → apps/admin/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Installer
FROM node:16-alpine as INSTALLER
# BUILDER
FROM node:16-alpine as BUILDER

# Caching
# RUN apk add --no-cache libc6-compat
RUN apk add --no-cache libc6-compat

WORKDIR /app

Expand All @@ -13,17 +13,12 @@ RUN apk update && \
RUN npm install -g @types/node \
&& npm install -g [email protected]

COPY . .

RUN npm install --force
##########################
RUN npm i -g turbo

# BUILDER
FROM node:16-alpine as BUILDER
COPY . .

RUN npm i -g turbo
COPY --from=INSTALLER . .
WORKDIR /app
RUN npm install -w=admin --force
RUN npm run build -w=packages

##########################

Expand Down
1 change: 0 additions & 1 deletion apps/admin/src/components/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export default () =>
{
// Fetch the data from the server
const [transactions, setTransactions] = React.useState<ITransactions<"income">[]>([]);
console.log(transactions);
const setAuth = () =>
{
return {
Expand Down
7 changes: 4 additions & 3 deletions apps/admin/src/components/configurable_options/Create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ export const Create_configurable_options = (props: any) =>
<FormTab label="General">
<TextInput label="Name" isRequired={true} source="name" />
{/* @ts-ignore */}
<ReferenceArrayInput filterToQuery={searchText => ({
"name": searchText,
})} perPage={100} source="products_ids" reference="products">
<ReferenceArrayInput perPage={100} source="products_ids" reference="products">
<AutocompleteArrayInput
source="products"
label="Products"
isRequired={true}
filterToQuery={searchText => ({
"name": searchText,
})}
optionText={(r: any) => `${r.name} - (${r.id})`}
/>
</ReferenceArrayInput>
Expand Down
7 changes: 4 additions & 3 deletions apps/admin/src/components/configurable_options/Edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ export const Edit_configurable_options = (props: any) =>
<FormTab label="General">
<TextInput label="Name" isRequired={true} source="name" />
{/* @ts-ignore */}
<ReferenceArrayInput filterToQuery={searchText => ({
"name": searchText,
})} perPage={100} source="products_ids" reference="products">
<ReferenceArrayInput perPage={100} source="products_ids" reference="products">
<AutocompleteArrayInput
source="products"
label="Products"
filterToQuery={searchText => ({
"name": searchText,
})}
isRequired={true}
optionText={(r: any) => `${r.name} - (${r.id})`}
/>
Expand Down
9 changes: 5 additions & 4 deletions apps/admin/src/components/customers/Edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,14 @@ export const EditCustomer = (props: any) =>
{
return { id: e, name: e };
})} fullWidth />
<ReferenceInput filterToQuery={(searchText: any) => ({
"id": searchText,
customer_uid: id,
})} perPage={100} allowEmpty label="Invoice id" source="invoice_id" reference="invoices">
<ReferenceInput perPage={100} allowEmpty label="Invoice id" source="invoice_id" reference="invoices">
<AutocompleteInput
isRequired={false}
optionText="id"
filterToQuery={(searchText: any) => ({
"id": searchText,
customer_uid: id,
})}
fullWidth
/>
</ReferenceInput>
Expand Down
15 changes: 8 additions & 7 deletions apps/admin/src/components/invoices/Create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,13 @@ export const CreateInvoices = (props: any) =>
<NumberInput isRequired={true} label="Amount" source="amount" />
<NumberInput label="Quantity" defaultValue={1} source="quantity" />
{/* @ts-ignore */}
<ReferenceInput filterToQuery={searchText => ({
"name": searchText,
})} perPage={100} source="product_id" reference="products">
<ReferenceInput perPage={100} source="product_id" reference="products">
<AutocompleteInput
source="product"
label="Product"
filterToQuery={searchText => ({
"name": searchText,
})}
isRequired={true}
fullWidth
optionText={(r: any) => `${r.name} - (${r.id})`}
Expand All @@ -86,10 +87,10 @@ export const CreateInvoices = (props: any) =>
</SimpleFormIterator>
</ArrayInput>

<ReferenceArrayInput filterToQuery={(searchText: string) => ({
"id": searchText,
})} perPage={100} source="transactions" reference="transactions">
<AutocompleteArrayInput fullWidth optionText={(record) => record?.id?.toString() ?? ""} />
<ReferenceArrayInput perPage={100} source="transactions" reference="transactions">
<AutocompleteArrayInput filterToQuery={(searchText: string) => ({
"id": searchText,
})} fullWidth optionText={(record) => record?.id?.toString() ?? ""} />
</ReferenceArrayInput>

</FormTab>
Expand Down
14 changes: 8 additions & 6 deletions apps/admin/src/components/invoices/Edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,13 @@ export const EditInvoices = (props: any) =>
<RichTextInput source="notes" />
<NumberInput isRequired={true} label="Amount" source="amount" />
<NumberInput label="Quantity" defaultValue={1} source="quantity" />
<ReferenceInput filterToQuery={(searchText: any) => ({
"name": searchText,
})} perPage={100} source="product_id" reference="products">
<ReferenceInput perPage={100} source="product_id" reference="products">
<AutocompleteInput
source="product"
label="Product"
filterToQuery={(searchText: any) => ({
"name": searchText,
})}
isRequired={true}
optionText={(r: any) => `${r.name} - (${r.id})`}
fullWidth
Expand All @@ -114,13 +115,14 @@ export const EditInvoices = (props: any) =>
</SimpleFormIterator>
</ArrayInput>

<ReferenceArrayInput filterToQuery={(searchText: any) => ({
"id": searchText,
})} perPage={100} source="transactions" reference="transactions">
<ReferenceArrayInput perPage={100} source="transactions" reference="transactions">
<AutocompleteArrayInput
source="transactions"
optionValue="id"
label="Transactions"
filterToQuery={(searchText: any) => ({
"id": searchText,
})}
fullWidth
optionText={(record: any) => record?.id?.toString() ?? ""}
/>
Expand Down
13 changes: 7 additions & 6 deletions apps/admin/src/components/products/Create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import
BooleanInput,
Create, FormTab,
NumberInput,
ReferenceArrayInput, AutocompleteInput,
AutocompleteInput,
SimpleFormIterator,
TabbedForm,
TextInput,
ReferenceInput,
} from "react-admin";
//@ts-ignore
import { RichTextInput } from 'ra-input-rich-text';
Expand All @@ -18,18 +19,18 @@ export const CreateProducts = (props: any) =>
<Create {...props}>
<TabbedForm>
<FormTab label="General">
{/* @ts-ignore */}
<ReferenceArrayInput filterToQuery={searchText => ({
"name": searchText,
})} perPage={100} source="category_uid" reference="categories">
<ReferenceInput perPage={100} source="category_uid" reference="categories">
<AutocompleteInput
source="categories"
label="Categories"
isRequired={true}
filterToQuery={searchText => ({
"name": searchText,
})}
fullWidth
optionText={(r: any) => `${r.name} - (${r.id})`}
/>
</ReferenceArrayInput>
</ReferenceInput>
<TextInput fullWidth isRequired={true} label="Name" source="name" />
<RichTextInput isRequired={true} label="Description" source="description" />
<BooleanInput label="Hidden" defaultValue={false} source="hidden" />
Expand Down
7 changes: 4 additions & 3 deletions apps/admin/src/components/products/Edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ export const EditProducts = (props: any) =>
<Edit mutationMode="pessimistic" {...props}>
<TabbedForm>
<FormTab label="General">
<ReferenceInput filterToQuery={(searchText: string) => ({
"name": searchText,
})} perPage={100} source="category_uid" reference="categories">
<ReferenceInput perPage={100} source="category_uid" reference="categories">
<AutocompleteInput
source="categories"
label="Category"
filterToQuery={(searchText: string) => ({
"name": searchText,
})}
isRequired={true}
fullWidth
optionText={(r: any) => `${r.name} - (${r.id})`}
Expand Down
2 changes: 1 addition & 1 deletion apps/admin/src/components/promotion_codes/Create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default function CreatePromotionCode(props: any)
source="products"
label="Products"
fullWidth
optionText="name"
optionText={(r: any) => `${r.name} - (${r.id})`}
/>
</ReferenceArrayInput>
</FormTab>
Expand Down
9 changes: 5 additions & 4 deletions apps/admin/src/components/promotion_codes/Edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ export default function EditPromotionCode(props: any)
<TextInput label="Valid to" source="valid_to" defaultValue={'permanent'} />
<NumberInput label="Max uses" source="uses" defaultValue={'unlimited'} />
<BooleanInput label="Percentage" source="percentage" />
<ReferenceArrayInput filterToQuery={(searchText: string) => ({
"name": searchText,
})} perPage={100} source="products_ids" reference="products">
<ReferenceArrayInput perPage={100} source="products_ids" reference="products">
<AutocompleteArrayInput
source="products"
label="Products"
filterToQuery={(searchText: string) => ({
"name": searchText,
})}
fullWidth
optionText="name"
optionText={(r: any) => `${r.name} - (${r.id})`}
/>
</ReferenceArrayInput>
</FormTab>
Expand Down
7 changes: 4 additions & 3 deletions apps/admin/src/components/quotes/Edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,13 @@ export default function EditQuote(props: any)
optionText={RenderFullName}
/>
</ReferenceInput>
<ReferenceArrayInput filterToQuery={(searchText: string) => ({
"name": searchText,
})} perPage={100} source="promotion_codes" reference="promotion_codes">
<ReferenceArrayInput perPage={100} source="promotion_codes" reference="promotion_codes">
<AutocompleteArrayInput
source="promotion_codes"
label="Promotion codes"
filterToQuery={(searchText: string) => ({
"name": searchText,
})}
fullWidth
optionText="name"
/>
Expand Down
7 changes: 4 additions & 3 deletions apps/admin/src/components/transactions/Create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@ export const CreateTransactions = (props: any) =>
/>
</ReferenceInput>
<div>
<ReferenceInput filterToQuery={(searchText: string) => ({
"id": searchText,
})} perPage={100} source="invoice_uid"
<ReferenceInput perPage={100} source="invoice_uid"
reference="invoices" allowEmpty>
<AutocompleteInput
fullWidth
filterToQuery={(searchText: string) => ({
"id": searchText,
})}
isRequired={formData.statement === "income"}
optionText={(record) => record?.id?.toString() ?? ""} />
</ReferenceInput>
Expand Down
7 changes: 4 additions & 3 deletions apps/admin/src/components/transactions/Edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ export const EditTrans = (props: any) =>
/>
</ReferenceInput>
<div>
<ReferenceInput filterToQuery={(searchText: string) => ({
"id": searchText,
})} perPage={100} source="invoice_uid" reference="invoices">
<ReferenceInput perPage={100} source="invoice_uid" reference="invoices">
<AutocompleteInput
isRequired={formData.statement === "income"}
fullWidth
filterToQuery={(searchText: string) => ({
"id": searchText,
})}
optionText={(record) => record?.id?.toString() ?? ""}
/>
</ReferenceInput>
Expand Down
Loading

0 comments on commit 297e142

Please sign in to comment.