Skip to content

Commit

Permalink
Merge pull request #2168 from ever-co/develop
Browse files Browse the repository at this point in the history
chore: switching to Ever Teams APIs (WIP)
  • Loading branch information
evereq authored Feb 6, 2024
2 parents c6fba5d + 54d18e6 commit 4589f5c
Show file tree
Hide file tree
Showing 14 changed files with 355 additions and 361 deletions.
509 changes: 250 additions & 259 deletions .cspell.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions .render/render.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ services:
- key: RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED
value: false
- key: NEXT_PUBLIC_GAUZY_API_SERVER_URL
value: https://apistage.gauzy.co
value: https://apidev.ever.team
- key: GAUZY_API_SERVER_URL
value: https://apistage.gauzy.co/api
value: https://apidev.ever.team/api
- key: NEXT_PUBLIC_GA_MEASUREMENT_ID
sync: false
- key: NEXT_PUBLIC_CAPTCHA_SITE_KEY
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Ever Teams Platform

ARG NODE_VERSION=18.17.1
ARG NEXT_PUBLIC_GAUZY_API_SERVER_URL=https://api.gauzy.co
ARG NEXT_PUBLIC_GAUZY_API_SERVER_URL=https://api.ever.team
ARG NEXT_PUBLIC_GA_MEASUREMENT_ID
ARG NEXT_PUBLIC_CAPTCHA_SITE_KEY
ARG NEXT_PUBLIC_DISABLE_AUTO_REFRESH=false
Expand Down
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ Note: Currently WIP, the screenshot is just a temporary picture :)

## 🔗 Links

- **<https://app.ever.team>** - Ever Teams Platform web application (not yet in production release)
- **<https://app.ever.team>** - Ever Teams Platform Web Application (not yet in production release).
- **<https://demo.ever.team>** - Ever Teams Platform Demo Web Application (not yet in production release).
- **<https://docs.ever.team>** - Ever Teams Platform Documentation (WIP).
- **<https://ever.team>** - Check more information about the Ever Teams platform at the official website (WIP).
- **<https://gauzy.co>** - Check more information about the Ever Gauzy Platform at the official website.
- **<https://ever.co>** - Get more information about our company products.
Expand All @@ -72,9 +74,10 @@ Ever® Teams™ Platform (<https://app.ever.team>) is built on top of our Busine
- [NextJs](https://nextjs.org)
- [React](https://reactjs.org)
- [React Native](https://reactnative.dev)
- [Tailwind](https://tailwindcss.com/) - CSS / Styles
- [shadcn/ui](https://ui.shadcn.com/) - Component Library
- [Vercel](https://vercel.com) - Hosting
- [Expo](https://expo.dev)
- [Tailwind](https://tailwindcss.com) - CSS / Styles
- [shadcn/ui](https://ui.shadcn.com), [Radix](https://www.radix-ui.com) and [HeadlessUI](https://headlessui.com) - Component Libraries
- [Vercel](https://vercel.com) and [DigitalOcean](https://www.digitalocean.com) - Hosting

#### See also README.md and CREDITS.md files in relevant folders for lists of libraries and software included in the Platform, information about licenses, and other details

Expand All @@ -95,13 +98,15 @@ Please refer to our official [Platform Documentation](https://docs.ever.team) (W
3. Run `yarn build:web`
4. Run `yarn start:web`

Note: by default, Ever Teams web frontend will be connected to our production [Ever Gauzy](https://github.com/ever-co/ever-gauzy) API endpoint <https://api.gauzy.co/api>. You can change it in environment variable `GAUZY_API_SERVER_URL`, see below how to run with a Self-hosted Backend.
Notes:

- by default, Ever Teams web frontend will be connected to our production [Ever Gauzy API](https://github.com/ever-co/ever-gauzy) API endpoint <https://api.ever.team/api>. You can change it in environment variables `GAUZY_API_SERVER_URL` and `NEXT_PUBLIC_GAUZY_API_SERVER_URL`, see below how to run with a Self-hosted Backend.

### Run with a Self-hosted Backend

1. Download and run the Ever Gauzy Server setup (<https://gauzy.co/downloads>) or run the server manually (see <https://github.com/ever-co/ever-gauzy/tree/develop/apps/server>). You can also run only Ever Gauzy APIs (manually), see <https://github.com/ever-co/ever-gauzy/tree/develop/apps/api>. For getting starting instructions, it's best to check the Ever Gauzy [README](https://github.com/ever-co/ever-gauzy/blob/develop/README.md) file.
2. Clone this repo
3. After you get the API or Server running, make sure you set the environment variable `GAUZY_API_SERVER_URL` in Ever Teams .env file (see <https://github.com/ever-co/ever-teams/blob/develop/web/.env.sample> for example).
3. After you get the API or Server running, make sure you set the environment variables `GAUZY_API_SERVER_URL` and `NEXT_PUBLIC_GAUZY_API_SERVER_URL` in Ever Teams .env file (see <https://github.com/ever-co/ever-teams/blob/develop/web/.env.sample> for example).
4. Run `yarn install`
5. Run `yarn build:web`
6. Run `yarn start:web`
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/.env.template
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# NOTE: do NOT ever put here any secure settings! (e.g. Secret Keys)
# We are using react-native-dotenv (.env)

GAUZY_API_URL=https://api.gauzy.co
GAUZY_API_URL=https://api.ever.team
INVITE_CALLBACK_URL=https://app.ever.team/auth/passcode
EXPO_PUBLIC_SENTRY_DSN=
SENTRY_ORG=ever-co
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/app/config/config.dev.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export default {
API_URL: "https://apistage.gauzy.co/api",
API_URL: "https://apidev.ever.team/api",
}
158 changes: 77 additions & 81 deletions apps/mobile/app/services/client/requests/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,140 +4,136 @@ import {
IRegisterDataRequest,
ISuccessResponse,
ISignInResponse,
ILoginResponse,
} from "../../interfaces/IAuthentication"
import { IUser } from "../../interfaces/IUserData"
import { serverFetch } from "../fetch"
ILoginResponse
} from '../../interfaces/IAuthentication';
import { IUser } from '../../interfaces/IUserData';
import { serverFetch } from '../fetch';

const registerDefaultValue = {
appName: "Ever Teams",
appSignature: "Ever Team",
appLogo: "https://app.ever.team/assets/ever-teams.png",
appLink: "https://ever.team/",
appEmailConfirmationUrl: "https://app.gauzy.co/#/auth/confirm-email",
}
appName: 'Ever Teams',
appSignature: 'Ever Team',
appLogo: 'https://app.ever.team/assets/ever-teams.png',
appLink: 'https://ever.team/',
appEmailConfirmationUrl: 'https://app.gauzy.co/#/auth/confirm-email'
};

export const registerUserRequest = (data: IRegisterDataRequest) => {
const body = {
...data,
...registerDefaultValue,
}
...registerDefaultValue
};

return serverFetch<IUser>({
path: "/auth/register",
method: "POST",
body,
})
}
path: '/auth/register',
method: 'POST',
body
});
};

export const loginUserRequest = (email: string, password: string) => {
return serverFetch<ILoginResponse>({
path: "/auth/login",
method: "POST",
path: '/auth/login',
method: 'POST',
body: {
email,
password,
},
})
}
password
}
});
};

export const whetherUserAuthenticatedRequest = (bearer_token: string) => {
return serverFetch<boolean>({
path: "/user/authenticated",
method: "GET",
bearer_token,
})
}
path: '/user/authenticated',
method: 'GET',
bearer_token
});
};

type IUEmployeeParam = {
bearer_token: string
relations?: string[]
}
bearer_token: string;
relations?: string[];
};

export const currentAuthenticatedUserRequest = ({
bearer_token,
relations = ["employee", "role", "tenant"],
relations = ['employee', 'role', 'tenant']
}: IUEmployeeParam) => {
const params = {} as { [x: string]: string }
const params = {} as { [x: string]: string };

relations.forEach((rl, i) => {
params[`relations[${i}]`] = rl
})
params[`relations[${i}]`] = rl;
});

const query = new URLSearchParams(params)
const query = new URLSearchParams(params);

return serverFetch<IUser>({
path: `/user/me?${query.toString()}`,
method: "GET",
bearer_token,
})
}
method: 'GET',
bearer_token
});
};

export const refreshTokenRequest = (refresh_token: string) => {
return serverFetch<{ token: string }>({
path: "/auth/refresh-token",
method: "POST",
path: '/auth/refresh-token',
method: 'POST',
body: {
refresh_token,
},
})
}
refresh_token
}
});
};
// auth/signin.email
export function sendAuthCodeRequest(email: string) {
return serverFetch<{ status: number; message: string | "ok" }>({
path: "/auth/signin.email",
method: "POST",
body: { email },
})
return serverFetch<{ status: number; message: string | 'ok' }>({
path: '/auth/signin.email',
method: 'POST',
body: { email }
});
}

// auth/signin.email/confirm Gives response with tenantId's
export function verifyAuthCodeRequest(email: string, code: string) {
return serverFetch<IEmailAndCodeConfirmResponse>({
path: "/auth/signin.email/confirm?includeTeams=true",
method: "POST",
body: { email, code },
})
path: '/auth/signin.email/confirm?includeTeams=true',
method: 'POST',
body: { email, code }
});
}

// auth/signin.workspace Need the email and the token from auth/signin.email/confirm

export const signInWorkspaceRequest = (email: string, token: string) => {
return serverFetch<ISignInResponse>({
path: "/auth/signin.workspace",
method: "POST",
body: { email, token },
})
}
path: '/auth/signin.workspace',
method: 'POST',
body: { email, token }
});
};

export const verifyUserEmailByCodeRequest = (data: {
bearer_token: string
code: string
email: string
tenantId: string
bearer_token: string;
code: string;
email: string;
tenantId: string;
}) => {
const { code, email, bearer_token, tenantId } = data
const { code, email, bearer_token, tenantId } = data;
return serverFetch<ISuccessResponse>({
path: "/auth/email/verify/code",
method: "POST",
path: '/auth/email/verify/code',
method: 'POST',
body: { code, email, tenantId },
tenantId: data.tenantId,
bearer_token,
})
}
bearer_token
});
};

export const resentVerifyUserLinkRequest = (data: {
bearer_token: string
email: string
tenantId: string
}) => {
const { email, bearer_token, tenantId } = data
export const resentVerifyUserLinkRequest = (data: { bearer_token: string; email: string; tenantId: string }) => {
const { email, bearer_token, tenantId } = data;

return serverFetch<ISuccessResponse>({
path: "/auth/email/verify/resend-link",
method: "POST",
path: '/auth/email/verify/resend-link',
method: 'POST',
body: { email, tenantId },
tenantId: data.tenantId,
bearer_token,
})
}
bearer_token
});
};
2 changes: 1 addition & 1 deletion apps/mobile/eas.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"autoIncrement": true,
"channel": "production",
"env": {
"GAUZY_API_URL": "https://api.gauzy.co",
"GAUZY_API_URL": "https://api.ever.team",
"INVITE_CALLBACK_URL": "https://app.ever.team/auth/passcode"
}
}
Expand Down
4 changes: 2 additions & 2 deletions apps/web/.env
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED=false

GAUZY_API_SERVER_URL=https://api.gauzy.co/api
NEXT_PUBLIC_GAUZY_API_SERVER_URL=https://api.gauzy.co
GAUZY_API_SERVER_URL=https://api.ever.team/api
NEXT_PUBLIC_GAUZY_API_SERVER_URL=https://api.ever.team
NEXT_PUBLIC_GA_MEASUREMENT_ID=

# CAPTCHA Settings
Expand Down
4 changes: 2 additions & 2 deletions apps/web/.env.sample
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED=false

GAUZY_API_SERVER_URL=https://api.gauzy.co/api
NEXT_PUBLIC_GAUZY_API_SERVER_URL=https://api.gauzy.co
GAUZY_API_SERVER_URL=https://api.ever.team/api
NEXT_PUBLIC_GAUZY_API_SERVER_URL=https://api.ever.team
NEXT_PUBLIC_GA_MEASUREMENT_ID=

# CAPTCHA Settings
Expand Down
3 changes: 2 additions & 1 deletion apps/web/app/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ export const RECAPTCHA_SITE_KEY = getNextPublicEnv(
export const RECAPTCHA_SECRET_KEY = process.env.CAPTCHA_SECRET_KEY;

// Gauzy Server URL
export const GAUZY_API_SERVER_URL = process.env.GAUZY_API_SERVER_URL || 'https://api.gauzy.co/api';
export const GAUZY_API_SERVER_URL = process.env.GAUZY_API_SERVER_URL || 'https://api.ever.team/api';

export const GAUZY_API_BASE_SERVER_URL = getNextPublicEnv(
'NEXT_PUBLIC_GAUZY_API_SERVER_URL',
process.env.NEXT_PUBLIC_GAUZY_API_SERVER_URL
Expand Down
2 changes: 0 additions & 2 deletions apps/web/app/services/server/requests/timer/timer-slot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,3 @@ export function deleteEmployeeTimeSlotsRequest({
tenantId
});
}

// https://apidemo.gauzy.co/api/timesheet/time-slot?ids[0]=71bde97d-f6e7-463a-90ef-c752072755ab&organizationId=0289f323-5aa5-4dc2-92c5-633f3e70ecb4&tenantId=ae69bf6c-072f-44cb-8f41-e981a3eccdb1
3 changes: 3 additions & 0 deletions apps/web/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ const nextConfig = {
'127.0.0.1',
'cdn-icons-png.flaticon.com', // Remove this domain once the Backend Icons list is added
'api.gauzy.co',
'apidev.gauzy.co',
'apistage.gauzy.co',
'api.ever.team',
'apidev.ever.team',
'gauzy.s3.wasabisys.com',
'gauzystage.s3.wasabisys.com'
]
Expand Down
4 changes: 2 additions & 2 deletions render.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ services:
- key: RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED
value: false
- key: NEXT_PUBLIC_GAUZY_API_SERVER_URL
value: https://api.gauzy.co
value: https://api.ever.team
- key: GAUZY_API_SERVER_URL
value: https://api.gauzy.co/api
value: https://api.ever.team/api
- key: NEXT_PUBLIC_GA_MEASUREMENT_ID
sync: false
- key: NEXT_PUBLIC_CAPTCHA_SITE_KEY
Expand Down

0 comments on commit 4589f5c

Please sign in to comment.