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

Feat/#1682 project team #1683

Merged
merged 5 commits into from
Oct 30, 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
11 changes: 6 additions & 5 deletions apps/web/app/services/server/requests/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { IUser } from '@app/interfaces';
export function getTeamTasksRequest({
tenantId,
organizationId,
// TODO
// projectId,
projectId,
teamId,
bearer_token,
relations = [
'tags',
Expand All @@ -27,15 +27,16 @@ export function getTeamTasksRequest({
bearer_token: string;
relations?: string[];
projectId?: string;
teamId: string
}) {
const obj = {
'where[organizationId]': organizationId,
'where[tenantId]': tenantId,
// TODO
// 'where[projectId]': projectId,
'where[projectId]': projectId,
'join[alias]': 'task',
'join[leftJoinAndSelect][members]': 'task.members',
'join[leftJoinAndSelect][user]': 'members.user'
'join[leftJoinAndSelect][user]': 'members.user',
'where[teams][0]': teamId
} as Record<string, string>;

relations.forEach((rl, i) => {
Expand Down
8 changes: 2 additions & 6 deletions apps/web/app/stores/team-tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import moment from 'moment';
import { ITeamTask } from '@app/interfaces/ITask';
import { ITasksTimesheet } from '@app/interfaces/ITimer';
import { atom, selector } from 'recoil';
import { activeTeamState } from './organization-team';

export const teamTasksState = atom<ITeamTask[]>({
key: 'teamTasksState',
Expand All @@ -28,13 +27,10 @@ export const tasksByTeamState = selector<ITeamTask[]>({
key: 'tasksByTeamState',
get: ({ get }) => {
const tasks = get(teamTasksState);
const activeTeam = get(activeTeamState);

return tasks
.filter((task) => {
return task.teams.some((tm) => {
return tm.id === activeTeam?.id;
});
.filter(() => {
return true
})
.sort((a, b) => moment(b.createdAt).diff(a.createdAt));
}
Expand Down
2 changes: 1 addition & 1 deletion apps/web/lib/features/team-members.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function TeamMembers({ publicTeam = false, kabanView = IssuesView.CARDS }
break;
case kabanView === IssuesView.CARDS:
teamMembersView = (
<TeamMembersCardView teamMembers={members} currentUser={currentUser} publicTeam={publicTeam} />
<TeamMembersCardView teamMembers={$members} currentUser={currentUser} publicTeam={publicTeam} />
);
break;
case kabanView === IssuesView.TABLE:
Expand Down
4 changes: 3 additions & 1 deletion apps/web/pages/api/tasks/[id].ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getTeamTasksRequest, updateTaskRequest, getTaskByIdRequest } from '@app
import { NextApiRequest, NextApiResponse } from 'next';

export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const { $res, user, tenantId, access_token, organizationId } = await authenticatedGuard(req, res);
const { $res, user, tenantId, access_token, organizationId, projectId, teamId} = await authenticatedGuard(req, res);
if (!user) return $res();

const { id: taskId } = req.query;
Expand Down Expand Up @@ -38,6 +38,8 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
const { data: tasks } = await getTeamTasksRequest({
tenantId,
organizationId,
projectId,
teamId,
bearer_token: access_token
});

Expand Down
3 changes: 2 additions & 1 deletion apps/web/pages/api/tasks/team.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { createTaskRequest, getTeamTasksRequest } from '@app/services/server/req
import { NextApiRequest, NextApiResponse } from 'next';

export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const { $res, user, tenantId, organizationId, access_token, projectId } = await authenticatedGuard(req, res);
const { $res, user, tenantId, organizationId, access_token, projectId, teamId } = await authenticatedGuard(req, res);
if (!user) return $res();

if (req.method === 'POST') {
Expand Down Expand Up @@ -42,6 +42,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
tenantId,
organizationId,
projectId,
teamId,
bearer_token: access_token
});

Expand Down
Loading