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

Development #147

Merged
merged 5 commits into from
Nov 27, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions apps/docs/pages/_meta.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"index": "Introduction",
"specifications": "Specifications",
"coding": "Coding Standards",
"frontend": "Front-End",
"backend": "Back-End",
"builds": "Build",
"setup":"Setup",
"about": {
Expand All @@ -11,7 +15,6 @@
"type": "page",
"href": "https://twitter.com/shuding_",
"newWindow": true
},
"frontend": "Front-End",
"backend": "Back-End"
}

}
1 change: 1 addition & 0 deletions apps/docs/pages/backend.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Back-End
4 changes: 2 additions & 2 deletions apps/docs/pages/builds/environment/auth0.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# **Accounts Authentication Auth0**
>
> ```.env filename=".env" copy
> # Providers Connections
> AUTH0_SECRET= ""
Expand All @@ -7,5 +8,4 @@
> AUTH0_CLIENT_ID= ""
> AUTH0_CLIENT_SECRET= ""
> ```
> > To get the secret environment key for Auth0
> >
> > To get the secret environment key for Auth0 you need to reach for your Auth0 developer of the group team.
6 changes: 5 additions & 1 deletion apps/docs/pages/builds/environment/database.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# **Database PostgreSQL**
>
> The WizePrompt database
> ```.env filename=".env" copy
> # DB PostgreSQL
Expand All @@ -8,4 +9,7 @@
> > ```js
> > npx prisma migrate
> > ```
> > You will need to have **Prisma** already installed
> > *You will need to have **Prisma** already installed.*
> > ```js
> > npm install @prisma/client
> > ```
5 changes: 3 additions & 2 deletions apps/docs/pages/builds/environment/openai.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
> # Providers Connections
> OPENAI_API_KEY= ""
> ```
> > To get the environment key
> >
> > To get the environment key you will need to follow the following steps.
> > Access to an openAI Account
> > Select your individual openAI secret key.
1 change: 1 addition & 0 deletions apps/docs/pages/builds/environment/pricing.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# **Chat GPT and Dall-E models pricing**
> >
> > *GPT Pricing*
> > ```.env filename=".env" copy
> > # GPT Model pricing per 1000 tokens
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/pages/builds/environment/s3bucket.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
> # S3 Bucket
> S3_SECRET_KEY = ""
> ```
> > To get the environment secret key for the S3 Bucket
> >
> > To get the environment secret key for the S3 Bucket you need to contact the AWS developer of the group team.
>
6 changes: 6 additions & 0 deletions apps/docs/pages/coding/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"base": "Base",
"nextjs": "Next.js",
"reactli": "React-Library"

}
27 changes: 27 additions & 0 deletions apps/docs/pages/coding/base.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
## Base

Base Configuration

```js filename="base.json" {1} copy
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Default",
"compilerOptions": {
"composite": false,
"declaration": true,
"declarationMap": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"inlineSources": false,
"isolatedModules": true,
"moduleResolution": "node",
"noUnusedLocals": false,
"noUnusedParameters": false,
"preserveWatchOutput": true,
"skipLibCheck": true,
"strict": true,
"strictNullChecks": true
},
"exclude": ["node_modules"]
}
```
27 changes: 27 additions & 0 deletions apps/docs/pages/coding/nextjs.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
## Nextjs

Nextjs Configuration

```js filename="nextjs.json" {1} copy
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Next.js",
"extends": "./base.json",
"compilerOptions": {
"plugins": [{ "name": "next" }],
"allowJs": true,
"declaration": false,
"declarationMap": false,
"incremental": true,
"jsx": "preserve",
"lib": ["dom", "dom.iterable", "esnext"],
"module": "esnext",
"noEmit": true,
"resolveJsonModule": true,
"strict": false,
"target": "es5"
},
"include": ["src", "next-env.d.ts"],
"exclude": ["node_modules"]
}
```
17 changes: 17 additions & 0 deletions apps/docs/pages/coding/reactli.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## React-Library

React-Library Configuration

```js filename="react-library.json" {1} copy
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "React Library",
"extends": "./base.json",
"compilerOptions": {
"jsx": "react-jsx",
"lib": ["ES2015", "DOM"],
"module": "ESNext",
"target": "es6"
}
}
```
1 change: 1 addition & 0 deletions apps/docs/pages/frontend.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Front-End
4 changes: 2 additions & 2 deletions apps/docs/pages/index.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Welcome to WizePrompt

## Project Overview
The web application WizePropmt is a software that permits the
The web application WizePrompt is a software that permits the
communication between a user and different types of AI
language models. Through the use of credits, WizePrompt is able to
manage and regulate the user consults to the language models.
Expand All @@ -24,4 +24,4 @@ David Gerardo Martínez - William Frank Monroy
Jackeline Conant
```

** About this file
## About this file
37 changes: 9 additions & 28 deletions apps/docs/pages/setup/gitcode.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,45 +3,26 @@
## Fetching git code to local system

Commands that will use Github tools to fetch WizePrompt git code to local system

* **Clone WizePrompt repository from Github web app:**

```js filename="TERMINAL" {1} copy
git clone https://github.com/wizelineacademy/itesm-socioformador-ago-dec-2023-team-02.git
```
* **Check the main development branch:**
>```js filename="TERMINAL" {1} copy
>git checkout development
>```
> ```js filename="TERMINAL" {1} copy
> git checkout development
> ```
> **Fetch any changes made to the development branch:**
>```js filename="TERMINAL" {1} copy
>git fetch
>```
> ```js filename="TERMINAL" {1} copy
> git fetch
> ```
> > If there are some changes to the branch write:
> > ```js filename="TERMINAL" {1} copy
> > git pull
> > ```
>If previous commands were used the git code should be already updated and inside the local repository.
> If previous commands were used the git code should be already updated and inside the local repository.

## Installing project specific dependency packages and tools

* **Pnpm package Manager**
> Pnpm is an efficient package manager for Wizepropmt dependencies installation.
> > **Pnpm installation**
> >
> *🞂 If you have pnpm installed already, skip this step and move to project dependencies.*
* **Project dependencies**
> Download and install the project dependencies for the app to run correctly with pnpm command.
>```js filename="TERMINAL" {1} copy
> pnpm install
>```
> This specific command will appear, wait for it to end installing and test.
> > 🞂 For the other dependencies you will need to access the **web** and **docs** folder of your local repository and repeat the pnpm command.
> If all the dependencies are installed the system will respond with:
>```js
> Scope: all 6 workspace projects
>../.. prepare$ husky install
>│ husky - Git hooks installed
>└─ Done in X.Xs
>Done in XX.Xs
>```

## Commands / Instructions for starting a server / OS service required by the project to run etc
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@

Tools and Hardware Requirements Declaration

# Software Requirements

# Hardware Requirements

## Specifications

Technical Specifications




42 changes: 14 additions & 28 deletions apps/web/components/admin/groupBody/molecules/group-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,20 +93,13 @@ export default function GroupTable({
try {
console.log("Selected keys: ", selectedKeys);
console.log("Selected keys2: ", Array.from(selectedKeys));
const response = await fetch(
`http://${
process.env.ENVIROMENT === "production"
? process.env.PROD_DOMAIN
: "localhost"
}:3000/api/groups/add-users/${idGroup}`,
{
method: "PATCH",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ userIds: Array.from(selectedKeys) }),
}
);
const response = await fetch(`/api/groups/add-users/${idGroup}`, {
method: "PATCH",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ userIds: Array.from(selectedKeys) }),
});

if (!response.ok) {
throw new Error(`HTTP Error: ${response.status}`);
Expand All @@ -126,20 +119,13 @@ export default function GroupTable({

const updateUserRole = async (userId: number, role: Role): Promise<void> => {
try {
const response = await fetch(
`http://${
process.env.ENVIROMENT === "production"
? process.env.PROD_DOMAIN
: "localhost"
}:3000/api/users/${userId}`,
{
method: "PATCH",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ role }),
}
);
const response = await fetch(`/api/users/${userId}`, {
method: "PATCH",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ role }),
});

if (!response.ok) {
throw new Error(`HTTP Error: ${response.status}`);
Expand Down
20 changes: 6 additions & 14 deletions apps/web/components/admin/groupBody/organisms/group-body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,12 @@ export default function GroupBody(): JSX.Element {
useEffect(() => {
async function getGroupData(): Promise<void> {
try {
console.log("enviroment", process.env);
const response = await fetch(
`http://${
process.env.ENVIROMENT === "production"
? process.env.PROD_DOMAIN
: "localhost"
}:3000/api/groups/${idGroup}`,
{
method: "GET",
headers: {
"Content-Type": "application/json",
},
}
);
const response = await fetch(`/api/groups/${idGroup}`, {
method: "GET",
headers: {
"Content-Type": "application/json",
},
});

if (!response.ok) {
throw new Error(`Error: ${response.status}`);
Expand Down
27 changes: 8 additions & 19 deletions apps/web/components/admin/modals/add-user-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,7 @@ function AddUserModal({
async function getUsers(): Promise<void> {
try {
// Modify the URL to include the groupId
const url = `http://${
process.env.ENVIROMENT === "production"
? process.env.PROD_DOMAIN
: "localhost"
}:3000/api/users/group/${idGroup}`;
const url = `/api/users/group/${idGroup}`;

const response = await fetch(url, {
method: "GET",
Expand Down Expand Up @@ -102,20 +98,13 @@ function AddUserModal({
const userIds = Array.from(values).map(Number);

// Send the POST request to your API endpoint
const response = await fetch(
`http://${
process.env.ENVIROMENT === "production"
? process.env.PROD_DOMAIN
: "localhost"
}:3000/api/groups/add-users/${idGroup}`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ userIds }),
}
);
const response = await fetch(`/api/groups/add-users/${idGroup}`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ userIds }),
});

if (!response.ok) {
throw new Error(`Error: ${response.status}`);
Expand Down
6 changes: 1 addition & 5 deletions apps/web/components/shared/molecules/global-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,7 @@ export default function GlobalContext(): JSX.Element {
setIsSubmitting(true);
// Assuming you have the user's ID and the API endpoint ready
const userId = prismaUser?.id; // Replace with actual user ID
const apiEndpoint = `http://${
process.env.ENVIROMENT === "production"
? process.env.PROD_DOMAIN
: "localhost"
}:3000/api/users/${userId}`; // Modify as per your API endpoint
const apiEndpoint = `/api/users/${userId}`; // Modify as per your API endpoint

// Converting form data to JSON
//const requestData = JSON.stringify(formParams);
Expand Down
Loading