Skip to content

Commit

Permalink
ASAP-767 Adding Assigned Users
Browse files Browse the repository at this point in the history
  • Loading branch information
gabiayako committed Jan 30, 2025
1 parent c935630 commit 66c6126
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 1 deletion.
2 changes: 2 additions & 0 deletions apps/crn-frontend/src/network/teams/__mocks__/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ export const getManuscripts = jest.fn(
id: 'DA1-000463-002-org-G-1',
lastUpdated: '2020-09-23T20:45:22.000Z',
manuscriptId: 'manuscript-id-1',
title: 'Manuscript 1',
teams: ['Team 1'],
team: {
id: 'team-id-1',
displayName: 'Team 1',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ export class ManuscriptContentfulDataProvider
const team = manuscript.teamsCollection?.items[0];
return {
manuscriptId: manuscript.sys.id,
title: manuscript.title || '',
teams: (manuscript.teamsCollection?.items || []).map(
(teamItem) => teamItem?.displayName || '',
),
status: manuscriptMapStatus(manuscript.status) || undefined,
id: getManuscriptVersionUID({
version: {
Expand Down
4 changes: 4 additions & 0 deletions apps/crn-server/test/fixtures/manuscript.fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ export const getManuscriptsListResponse =
{
id: 'ID01-grant-001-org-P-1',
manuscriptId: 'manuscript-id-1',
title: 'Manuscript 1',
teams: ['Team A'],
requestingApcCoverage: 'Yes',
lastUpdated: '2020-09-23T20:45:22.000Z',
status: 'Compliant',
Expand All @@ -248,6 +250,8 @@ export const getManuscriptsListResponse =
{
id: 'ID01-grant-002-org-P-1',
manuscriptId: 'manuscript-id-2',
title: 'Manuscript 2',
teams: ['Team A'],
requestingApcCoverage: 'Yes',
lastUpdated: '2020-09-23T20:45:22.000Z',
status: 'Compliant',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
module.exports.description = 'Add assigned users field to manuscripts';

module.exports.up = (migration) => {
const manuscripts = migration.editContentType('manuscripts');

manuscripts
.createField('assignedUsers')
.name('Assigned Users')
.type('Array')
.localized(false)
.required(false)
.disabled(false)
.omitted(false)
.items({
type: 'Link',

validations: [
{
linkContentType: ['users'],
},
],

linkType: 'Entry',
});
};

module.exports.down = (migration) => {
const manuscripts = migration.editContentType('manuscripts');
manuscripts.deleteField('assignedUsers');
};
2 changes: 2 additions & 0 deletions packages/fixtures/src/manuscripts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ export const createPartialManuscriptResponse =
(): PartialManuscriptResponse => ({
id: 'DA1-000463-003-org-G-1',
manuscriptId: 'manuscript-1',
title: 'Manuscript 1',
teams: ['Team 1'],
lastUpdated: '2020-09-23T20:45:22.000Z',
team: {
id: 'team-id-1',
Expand Down
3 changes: 2 additions & 1 deletion packages/model/src/manuscript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -823,14 +823,15 @@ export type PartialManuscriptResponse = Pick<
ManuscriptVersion,
'id' | 'requestingApcCoverage'
> &
Pick<ManuscriptResponse, 'status'> & {
Pick<ManuscriptResponse, 'status' | 'title'> & {
lastUpdated: string;
team: { id: string; displayName: string };
assignedUsers?: Pick<
UserResponse,
'id' | 'firstName' | 'lastName' | 'avatarUrl'
>[];
manuscriptId: string;
teams: string[];
};

export type ListPartialManuscriptResponse =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ describe('ComplianceTable', () => {
team: { id: 'team-id', displayName: 'Test Team' },
requestingApcCoverage: 'Yes',
manuscriptId: 'manuscript-id-1',
title: 'Manuscript 1',
teams: ['Test Team'],
assignedUsers: [
{
id: 'user-id',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ describe('ComplianceTableRow', () => {
requestingApcCoverage: 'Yes',
manuscriptId: 'manuscript-id-1',
assignedUsers: [],
title: 'Manuscript 1',
teams: ['Test Team'],
};

const mockOnUpdateManuscript = jest.fn();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ describe('ComplianceDashboard', () => {
team: { id: 'team-1', displayName: 'Test Team' },
assignedUsers: [],
manuscriptId: '1',
title: 'Manuscript 1',
teams: ['Test Team'],
},
],
numberOfPages: 1,
Expand Down

0 comments on commit 66c6126

Please sign in to comment.