Skip to content

Commit

Permalink
Merge pull request #2463 from ever-co/develop
Browse files Browse the repository at this point in the history
Update deploy-api-do-stage.yml
  • Loading branch information
evereq authored Apr 30, 2024
2 parents 7a802a2 + 45eb654 commit 61c4b9a
Show file tree
Hide file tree
Showing 35 changed files with 180 additions and 70 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-api-do-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
deploy-api-stage:
runs-on: buildjet-4vcpu-ubuntu-2204

environment: prod
environment: stage

steps:
- name: Checkout
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export function getAllOrganizationTeamRequest(
'where[organizationId]': organizationId,
'where[tenantId]': tenantId,
source: 'BROWSER',
withLaskWorkedTask: 'true',
withLastWorkedTask: 'true',
...Object.fromEntries(relations.map((relation, index) => [`relations[${index}]`, relation]))
};

Expand Down
43 changes: 31 additions & 12 deletions apps/mobile/app/services/client/requests/organization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,50 @@ import { PaginationResponse } from '../../interfaces/IDataResponse';
import { IOrganization, IOrganizationCreate, IUserOrganization } from '../../interfaces/IOrganization';
import { serverFetch } from '../fetch';

export function createOrganizationRequest(datas: IOrganizationCreate, bearer_token: string) {
export function createOrganizationRequest(datas: IOrganizationCreate, bearerToken: string) {
return serverFetch<IOrganization>({
path: '/organization',
method: 'POST',
body: datas,
bearer_token
bearer_token: bearerToken
});
}

/**
* Constructs a request to fetch user organizations based on tenant and user ID.
*
* @param param0 - Object containing tenantId and userId.
* @param bearer_token - Bearer token for authorization.
* @returns A promise resolving to a pagination response of user organizations.
*/
export function getUserOrganizationsRequest(
{ tenantId, userId }: { tenantId: string; userId: string },
bearer_token: string
bearerToken: string
) {
const query = new URLSearchParams({
relations: new URLSearchParams([]).toString(),
findInput: new URLSearchParams({
userId,
tenantId
}).toString()
if (!tenantId || !userId || !bearerToken) {
throw new Error('Tenant ID, User ID, and Bearer token are required'); // Validate parameters
}

// Create query string instance
const query = new URLSearchParams();

// Add tenant and user IDs to the query
query.append('where[userId]', userId);
query.append('where[tenantId]', tenantId);

// Relations to be included in the query
const relations: string[] = []; // You can define relations based on context

// Append each relation to the query string
relations.forEach((relation, index) => {
query.append(`relations[${index}]`, relation);
});

// Construct the request with the bearer token and additional parameters
return serverFetch<PaginationResponse<IUserOrganization>>({
path: `/user-organization?data=${query.toString()}`,
path: `/user-organization?${query.toString()}`, // Use toString() for query
method: 'GET',
bearer_token,
tenantId
bearer_token: bearerToken, // Include bearer token for authorization
tenantId // Additional context if needed
});
}
34 changes: 25 additions & 9 deletions apps/web/app/services/client/api/auth/invite-accept.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,36 @@ export function verifyInviteCodeAPI(params: IInviteVerifyCode) {
return post<IInviteVerified>('/invite/validate-by-code', params).then((res) => res.data);
}

export function getUserOrganizationsRequest(params: { tenantId: string; userId: string; token: string }) {
const query = JSON.stringify({
relations: [],
findInput: {
userId: params.userId,
tenantId: params.tenantId
}
/**
* Constructs a request to fetch user organizations with tenant and user ID.
*
* @param params - Parameters including tenantId, userId, and token for authentication.
* @returns A promise that resolves to a pagination response of user organizations.
*/
export function getUserOrganizationsRequest(params: {
tenantId: string;
userId: string;
token: string
}) {
// Create a new instance of URLSearchParams for query string construction
const query = new URLSearchParams();

// Add user and tenant IDs to the query
query.append('where[userId]', params.userId);
query.append('where[tenantId]', params.tenantId);

// If there are relations, add them to the query
const relations: string[] = [];
// Append each relation to the query string
relations.forEach((relation, index) => {
query.append(`relations[${index}]`, relation);
});

return get<PaginationResponse<IUserOrganization>>(`/user-organization?data=${encodeURIComponent(query)}`, {
return get<PaginationResponse<IUserOrganization>>(`/user-organization?${query.toString()}`, {
tenantId: params.tenantId,
headers: {
Authorization: `Bearer ${params.token}`
}
},
});
}

Expand Down
4 changes: 2 additions & 2 deletions apps/web/app/services/client/api/public-organization-team.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function getPublicOrganizationTeamsAPI(profile_link: string, team_id: str
];

const params = {
withLaskWorkedTask: 'true',
withLastWorkedTask: 'true',
startDate: moment().startOf('day').toISOString(),
endDate: moment().endOf('day').toISOString()
} as { [x: string]: string };
Expand All @@ -39,7 +39,7 @@ export function getPublicOrganizationTeamsMiscDataAPI(profile_link: string, team
const relations = ['statuses', 'priorities', 'sizes', 'labels', 'issueTypes'];

const params = {
withLaskWorkedTask: 'true',
withLastWorkedTask: 'true',
startDate: moment().startOf('day').toISOString(),
endDate: moment().endOf('day').toISOString()
} as { [x: string]: string };
Expand Down
47 changes: 32 additions & 15 deletions apps/web/app/services/server/requests/organization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,48 @@ import { PaginationResponse } from '@app/interfaces/IDataResponse';
import { IOrganization, IOrganizationCreate, IUserOrganization } from '@app/interfaces/IOrganization';
import { serverFetch } from '../fetch';

export function createOrganizationRequest(datas: IOrganizationCreate, bearer_token: string) {
export function createOrganizationRequest(datas: IOrganizationCreate, bearerToken: string) {
return serverFetch<IOrganization>({
path: '/organization',
method: 'POST',
body: datas,
bearer_token
bearer_token: bearerToken
});
}

export function getUserOrganizationsRequest(
{ tenantId, userId }: { tenantId: string; userId: string },
bearer_token: string
) {
const query = JSON.stringify({
relations: [],
findInput: {
userId,
tenantId
}
/**
* Constructs a GET request to fetch user organizations based on tenant and user IDs.
*
* @param param0 - Contains the tenantId and userId.
* @param bearerToken - The bearer token for authorization.
* @returns A promise resolving to a pagination response of user organizations.
* @throws Error if required parameters are missing or invalid.
*/
export function getUserOrganizationsRequest({ tenantId, userId }: {
tenantId: string;
userId: string
}, bearerToken: string) {
if (!tenantId || !userId || !bearerToken) {
throw new Error('Tenant ID, User ID, and Bearer token are required'); // Validate required parameters
}
// Create a new instance of URLSearchParams for query string construction
const query = new URLSearchParams();

// Add user and tenant IDs to the query
query.append('where[userId]', userId);
query.append('where[tenantId]', tenantId);

// If there are relations, add them to the query
const relations: string[] = [];
// Append each relation to the query string
relations.forEach((relation, index) => {
query.append(`relations[${index}]`, relation);
});

return serverFetch<PaginationResponse<IUserOrganization>>({
path: `/user-organization?data=${encodeURIComponent(query)}`,
method: 'GET',
bearer_token,
path: `/user-organization?${query.toString()}`, // Build query string
method: 'GET', // GET request
bearer_token: bearerToken, // Include bearer token in headers
tenantId
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function getPublicOrganizationTeamRequest({
relations?: string[];
}) {
const params = {
withLaskWorkedTask: 'true',
withLastWorkedTask: 'true',
startDate: moment().startOf('day').toISOString(),
endDate: moment().endOf('day').toISOString()
} as { [x: string]: string };
Expand All @@ -49,7 +49,7 @@ export function getPublicOrganizationTeamMiscDataRequest({
relations?: string[];
}) {
const params = {
withLaskWorkedTask: 'true',
withLastWorkedTask: 'true',
startDate: moment().startOf('day').toISOString(),
endDate: moment().endOf('day').toISOString()
} as { [x: string]: string };
Expand Down
4 changes: 3 additions & 1 deletion apps/web/lib/features/team-members-block-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { UserTeamBlock } from './team/user-team-block';
import { useRecoilValue } from 'recoil';
import { taskBlockFilterState } from '@app/stores/task-filter';
import { UserTeamCardSkeleton } from './team/user-team-card/task-skeleton';
import { useTranslations } from 'next-intl';

interface Props {
teamMembers: OT_Member[];
Expand All @@ -22,10 +23,11 @@ const TeamMembersBlockView: React.FC<Props> = ({
const activeFilter = useRecoilValue(taskBlockFilterState);

let emptyMessage = '';
const t = useTranslations();

switch (activeFilter) {
case 'online':
emptyMessage = 'There are no users online.';
emptyMessage = t('common.NO_USERS_ONLINE');
break;
case 'running':
emptyMessage = 'No users are currently working.';
Expand Down
4 changes: 3 additions & 1 deletion apps/web/lib/features/team/user-team-block/task-info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { IClassName } from '@app/interfaces';
import { clsxm } from '@app/utils';
import { TaskAllStatusTypes, TaskInput, TaskNameInfoDisplay } from 'lib/features';
import { useRouter } from 'next/navigation';
import { useTranslations } from 'next-intl';

type Props = IClassName & {
edition: I_TMCardTaskEditHook;
Expand All @@ -29,6 +30,7 @@ export function TaskInfo({ className, memberInfo, edition, publicTeam }: Props)
}

export function TaskBlockInfo({ className, memberInfo, edition, publicTeam }: Props) {
const t = useTranslations();
return (
<div className={clsxm('h-full flex flex-col items-start justify-between gap-[1.0625rem]', className)}>
{/* task */}
Expand All @@ -38,7 +40,7 @@ export function TaskBlockInfo({ className, memberInfo, edition, publicTeam }: Pr
)}
{!edition.task && (
<div className="text-center">
<p>There is no task assigned </p>
<p>{t('common.THERE_IS_NO_TASK_ASSIGNED')}</p>
</div>
)}
</div>
Expand Down
4 changes: 3 additions & 1 deletion apps/web/messages/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@
"GITHUB_INTEGRATION_AUTO_SYNC_TASK_TEXT": "قم بمزامنة المهام تلقائيًا في تطبيقك لتحديثات سلسة وفعّالة.",
"GITHUB_INTEGRATION_LABEL_SYNC_TASK_TEXT": "تزامن المهام بشكل انتقائي عن طريق ربطها بتصنيف معين.",
"GITHUB_AUTO_SYNC_LABEL": "اختر تسمية التزامن التلقائي",
"GITHUB_INTEGRATION_SUBTITLE_TEXT": "قم بتفعيل تكامل GitHub لمزامنة المشروع والمستودع"
"GITHUB_INTEGRATION_SUBTITLE_TEXT": "قم بتفعيل تكامل GitHub لمزامنة المشروع والمستودع",
"THERE_IS_NO_TASK_ASSIGNED": "لا توجد مهام معينة",
"NO_USERS_ONLINE": "لا يوجد مستخدمين على الانترنت"
},
"alerts": {
"REAL_TIME_ON_WORKING": "نحن نعمل على المزامنة في الوقت الحقيقي في الوقت الحالي، يرجى التحقق من هذه الميزة لاحقًا",
Expand Down
4 changes: 3 additions & 1 deletion apps/web/messages/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@
"GITHUB_LOADING_TEXT": "В момента инсталираме вашия GitHub интеграция, изчакайте...",
"GITHUB_INTEGRATION_AUTO_SYNC_TASK_TEXT": "Автоматично синхронизирайте задачите в приложението си за безпроблемни и ефективни актуализации.",
"GITHUB_INTEGRATION_LABEL_SYNC_TASK_TEXT": "Синхронизирайте задачите избирателно, като ги свържете с конкретен етикет.",
"GITHUB_AUTO_SYNC_LABEL": "Изберете етикет за автоматична синхронизация"
"GITHUB_AUTO_SYNC_LABEL": "Изберете етикет за автоматична синхронизация",
"THERE_IS_NO_TASK_ASSIGNED": "Няма възложени задачи",
"NO_USERS_ONLINE": "Няма потребители онлайн"
},
"alerts": {
"REAL_TIME_ON_WORKING": "В момента работим върху синхронизирането в реално време, моля, проверете тази функция по-късно.",
Expand Down
5 changes: 4 additions & 1 deletion apps/web/messages/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,10 @@
"GITHUB_INTEGRATION_SUBTITLE_TEXT": "Activate GitHub Integration for project & repository sync",
"GITHUB_INTEGRATION_AUTO_SYNC_TASK_TEXT": "Synchronisieren Sie Aufgaben in Ihrer Anwendung automatisch für nahtlose und effiziente Aktualisierungen.",
"GITHUB_INTEGRATION_LABEL_SYNC_TASK_TEXT": "Synchronisieren Sie Aufgaben selektiv, indem Sie sie mit einem bestimmten Label verknüpfen.",
"GITHUB_AUTO_SYNC_LABEL": "Auto-Sync-Label auswählen"
"GITHUB_AUTO_SYNC_LABEL": "Auto-Sync-Label auswählen",
"THERE_IS_NO_TASK_ASSIGNED": "Es ist keine Aufgabe zugewiesen",
"NO_USERS_ONLINE": "Es sind keine Benutzer online"

},
"alerts": {
"REAL_TIME_ON_WORKING": "Wir arbeiten derzeit an der Echtzeitsynchronisierung. Bitte überprüfen Sie diese Funktion später.",
Expand Down
4 changes: 3 additions & 1 deletion apps/web/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@
"GITHUB_INTEGRATION_SUBTITLE_TEXT": "Activate GitHub Integration for project & repository sync",
"GITHUB_INTEGRATION_AUTO_SYNC_TASK_TEXT": "Automatically synchronize tasks in your application for seamless and efficient updates.",
"GITHUB_INTEGRATION_LABEL_SYNC_TASK_TEXT": "Synchronize tasks selectively by associating them with specific label.",
"GITHUB_AUTO_SYNC_LABEL": "Select Auto-Sync Label"
"GITHUB_AUTO_SYNC_LABEL": "Select Auto-Sync Label",
"THERE_IS_NO_TASK_ASSIGNED": "There is no task assigned",
"NO_USERS_ONLINE": "There are no users online"
},
"alerts": {
"REAL_TIME_ON_WORKING": "We are working on Real-Time Sync at the moment, please check on this feature later.",
Expand Down
4 changes: 3 additions & 1 deletion apps/web/messages/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@
"GITHUB_INTEGRATION_AUTO_SYNC_TASK_TEXT": "Sincronice automáticamente tareas en su aplicación para actualizaciones fluidas y eficientes.",
"GITHUB_INTEGRATION_LABEL_SYNC_TASK_TEXT": "Sincronice tareas de manera selectiva asociándolas con una etiqueta específica.",
"GITHUB_AUTO_SYNC_LABEL": "Seleccionar etiqueta de sincronización automática",
"GITHUB_INTEGRATION_SUBTITLE_TEXT": "Activa la integración de GitHub para la sincronización de proyectos y repositorios"
"GITHUB_INTEGRATION_SUBTITLE_TEXT": "Activa la integración de GitHub para la sincronización de proyectos y repositorios",
"THERE_IS_NO_TASK_ASSIGNED": "No hay tareas asignadas",
"NO_USERS_ONLINE": "No hay usuarios en línea"
},
"alerts": {
"REAL_TIME_ON_WORKING": "Estamos trabajando en la sincronización en tiempo real en este momento; verifique esta función más adelante.",
Expand Down
4 changes: 3 additions & 1 deletion apps/web/messages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@
"GITHUB_INTEGRATION_AUTO_SYNC_TASK_TEXT": "Synchronisez automatiquement les tâches dans votre application pour des mises à jour fluides et efficaces.",
"GITHUB_INTEGRATION_LABEL_SYNC_TASK_TEXT": "Synchronisez sélectivement les tâches en les associant à une étiquette spécifique.",
"GITHUB_AUTO_SYNC_LABEL": "Sélectionner l'étiquette de synchronisation automatique",
"GITHUB_INTEGRATION_SUBTITLE_TEXT": "Activez l'intégration GitHub pour la synchronisation des projets et des dépôts"
"GITHUB_INTEGRATION_SUBTITLE_TEXT": "Activez l'intégration GitHub pour la synchronisation des projets et des dépôts",
"THERE_IS_NO_TASK_ASSIGNED": "Aucune tâche n'est assignée",
"NO_USERS_ONLINE": "Aucun utilisateur en ligne"
},
"alerts": {
"REAL_TIME_ON_WORKING": "Nous travaillons actuellement sur la synchronisation en temps réel, veuillez vérifier cette fonctionnalité plus tard.",
Expand Down
4 changes: 3 additions & 1 deletion apps/web/messages/he.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@
"GITHUB_INTEGRATION_AUTO_SYNC_TASK_TEXT": "סנכרן משימות באופן אוטומטי באפליקציה שלך לעדכונים חלקים ויעילים.",
"GITHUB_INTEGRATION_LABEL_SYNC_TASK_TEXT": "סנכרן משימות באופן בררני על ידי הקשרתן לתג מסוים.",
"GITHUB_AUTO_SYNC_LABEL": "בחר תגית אוטומטית לסנכרון",
"GITHUB_INTEGRATION_SUBTITLE_TEXT": "הפעל אינטגרציה של GitHub עבור סנכרון פרויקטים ומאגרים"
"GITHUB_INTEGRATION_SUBTITLE_TEXT": "הפעל אינטגרציה של GitHub עבור סנכרון פרויקטים ומאגרים",
"THERE_IS_NO_TASK_ASSIGNED": "אין משימות מוקצות",
"NO_USERS_ONLINE": "אין משתמשים מחוברים"
},
"alerts": {
"REAL_TIME_ON_WORKING": "אנחנו עובדים על סנכרון בזמן אמת כרגע, אנא בדוק את התכונה הזו מאוחר יותר.",
Expand Down
4 changes: 3 additions & 1 deletion apps/web/messages/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@
"GITHUB_LOADING_TEXT": "Stiamo installando la tua integrazione GitHub, attendi...",
"GITHUB_INTEGRATION_AUTO_SYNC_TASK_TEXT": "Sincronizza automaticamente le attività nella tua applicazione per aggiornamenti senza intoppi ed efficienti.",
"GITHUB_INTEGRATION_LABEL_SYNC_TASK_TEXT": "Sincronizza le attività in modo selettivo associandole a un'etichetta specifica.",
"GITHUB_AUTO_SYNC_LABEL": "Seleziona etichetta di sincronizzazione automatica"
"GITHUB_AUTO_SYNC_LABEL": "Seleziona etichetta di sincronizzazione automatica",
"THERE_IS_NO_TASK_ASSIGNED": "Non è stato assegnato alcun compito",
"NO_USERS_ONLINE": "Nessun utente online"
},
"alerts": {
"REAL_TIME_ON_WORKING": "Stiamo lavorando alla sincronizzazione in tempo reale al momento, controlla questa funzionalità più tardi.",
Expand Down
4 changes: 3 additions & 1 deletion apps/web/messages/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@
"GITHUB_LOADING_TEXT": "We zijn nu uw GitHub-integratie aan het installeren, even geduld...",
"GITHUB_INTEGRATION_AUTO_SYNC_TASK_TEXT": "Synchroniseer taken automatisch in uw applicatie voor naadloze en efficiënte updates.",
"GITHUB_INTEGRATION_LABEL_SYNC_TASK_TEXT": "Synchroniseer taken selectief door ze te koppelen aan een specifiek label.",
"GITHUB_AUTO_SYNC_LABEL": "Selecteer Auto-Sync-label"
"GITHUB_AUTO_SYNC_LABEL": "Selecteer Auto-Sync-label",
"THERE_IS_NO_TASK_ASSIGNED": "Er is geen taak toegewezen",
"NO_USERS_ONLINE": "Geen gebruiker online"
},
"alerts": {
"REAL_TIME_ON_WORKING": "We werken momenteel aan Real-Time Sync. Bekijk deze functie later opnieuw.",
Expand Down
4 changes: 3 additions & 1 deletion apps/web/messages/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@
"GITHUB_LOADING_TEXT": "Aktualnie instalujemy integrację GitHub, proszę czekać...",
"GITHUB_INTEGRATION_AUTO_SYNC_TASK_TEXT": "Automatycznie synchronizuj zadania w swojej aplikacji, aby uzyskać płynne i efektywne aktualizacje.",
"GITHUB_INTEGRATION_LABEL_SYNC_TASK_TEXT": "Synchronizuj zadania selektywnie, łącząc je z konkretną etykietą.",
"GITHUB_AUTO_SYNC_LABEL": "Wybierz etykietę automatycznej synchronizacji"
"GITHUB_AUTO_SYNC_LABEL": "Wybierz etykietę automatycznej synchronizacji",
"THERE_IS_NO_TASK_ASSIGNED": "Nie ma przypisanego zadania",
"NO_USERS_ONLINE": "Brak użytkowników online"
},
"alerts": {
"REAL_TIME_ON_WORKING": "W tej chwili pracujemy nad synchronizacją w czasie rzeczywistym. Sprawdź tę funkcję później.",
Expand Down
5 changes: 4 additions & 1 deletion apps/web/messages/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,10 @@
"GITHUB_LOADING_TEXT": "Estamos agora a instalar a sua integração do GitHub, aguarde...",
"GITHUB_INTEGRATION_AUTO_SYNC_TASK_TEXT": "Sincronize automaticamente tarefas em seu aplicativo para atualizações sem interrupções e eficientes.",
"GITHUB_INTEGRATION_LABEL_SYNC_TASK_TEXT": "Sincronize tarefas seletivamente associando-as a uma etiqueta específica.",
"GITHUB_AUTO_SYNC_LABEL": "Selecionar rótulo de sincronização automática"
"GITHUB_AUTO_SYNC_LABEL": "Selecionar rótulo de sincronização automática",
"THERE_IS_NO_TASK_ASSIGNED": "Não há tarefas atribuídas",
"NO_USERS_ONLINE": "Nenhum usuário online"

},
"alerts": {
"REAL_TIME_ON_WORKING": "Estamos trabalhando na sincronização em tempo real no momento. Verifique esse recurso mais tarde.",
Expand Down
Loading

0 comments on commit 61c4b9a

Please sign in to comment.