Teams refactor: removed team websites.

This commit is contained in:
Mike Cao 2024-01-25 23:20:53 -08:00
parent 0d442b751d
commit f85393f8df
23 changed files with 190 additions and 351 deletions

View file

@ -68,7 +68,12 @@ export default async (
});
}
log(`Login from ip ${getIpAddress(req)} with username "${username.replace(/["\r\n]/g, '')}" failed.`);
log(
`Login from ip ${getIpAddress(req)} with username "${username.replace(
/["\r\n]/g,
'',
)}" failed.`,
);
return unauthorized(res, 'message.incorrect-username-password');
}

View file

@ -6,7 +6,6 @@ import { pageInfo } from 'lib/schema';
import { NextApiResponse } from 'next';
import { methodNotAllowed, ok, unauthorized } from 'next-basics';
import { getWebsitesByTeamId } from 'queries';
import { createTeamWebsites } from 'queries/admin/teamWebsite';
export interface TeamWebsiteRequestQuery extends SearchFilter {
id: string;
@ -52,17 +51,5 @@ export default async (
return ok(res, websites);
}
if (req.method === 'POST') {
if (!(await canViewTeam(req.auth, teamId))) {
return unauthorized(res);
}
const { websiteIds } = req.body;
const websites = await createTeamWebsites(teamId, websiteIds);
return ok(res, websites);
}
return methodNotAllowed(res);
};