Skip to content
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
8 changes: 5 additions & 3 deletions .env.tests
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ KAFKA_PASSWORD=test
KAFKA_TOPIC=TestTopic

SCICAT_BASE_URL=http://localhost/some/api
SCICAT_LOGIN_ENDPOINT=/login
SCICAT_USERNAME=user
SCICAT_PASSWORD=pass
SCICAT_JWT=eyJhbGciOiJIUzI1NiIsInR5
SCICAT_PROPOSAL_TRIGGERING_STATUSES="SCHEDULING, ALLOCATED"

USER_OFFICE_GRAPHQL_URL=http://localhost:8080
USER_OFFICE_JWT=some-token

SYNAPSE_SERVER_URL=https://server-scichat
SYNAPSE_SERVER_NAME=serverName
SYNAPSE_SERVICE_USER=user
Expand All @@ -23,6 +24,7 @@ SYNAPSE_OAUTH_ISSUER=SAMPLE_ISSUER

USER_OFFICE_CORE_EXCHANGE_NAME=user_office_backend.fanout
PROPOSAL_CREATION_QUEUE_NAME=connector.proposal_creation.queue
EXPERIMENT_CREATION_QUEUE_NAME=connector.experiment_creation.queue
CHATROOM_CREATION_QUEUE_NAME=consumer.chatroom_creation.queue
FOLDER_CREATION_QUEUE_NAME=connector.proposals_folders_creation.queue
VISA_QUEUE_NAME=dummy
Expand Down
5 changes: 5 additions & 0 deletions src/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ jest.mock('express', () => {

return jest.fn(() => express);
});
jest.mock('./queue/consumers/scicat/scicatProposal/utils/scicatApi', () => ({
scicatApi: {
serviceUsername: 'testuser',
},
}));

jest.mock('@user-office-software/duo-logger');
jest.mock('./middlewares/metrics/metrics', () => jest.fn());
Expand Down
5 changes: 5 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ async function bootstrap() {
const enableScicatProposalUpsert = str2Bool(
process.env.ENABLE_SCICAT_PROPOSAL_UPSERT as string
);
const enableScicatExperimentUpsert = str2Bool(
process.env.ENABLE_SCICAT_EXPERIMENT_UPSERT as string
);
const enableScichatRoomCreation = str2Bool(
process.env.ENABLE_SCICHAT_ROOM_CREATION as string
);
Expand All @@ -55,6 +58,7 @@ async function bootstrap() {

logger.logInfo('Services configuration', {
SciCat_Proposal_Upsert: enableScicatProposalUpsert,
SciCat_Experiment_Upsert: enableScicatExperimentUpsert,
Scichat_Room_Creation: enableScichatRoomCreation,
Proposal_Folders_Creation: enableProposalFoldersCreation,
Nicos_to_Scichat_Messages: enableNicosToScichatMessages,
Expand All @@ -75,6 +79,7 @@ async function bootstrap() {

if (
enableScicatProposalUpsert ||
enableScicatExperimentUpsert ||
enableScichatRoomCreation ||
enableProposalFoldersCreation ||
enableMoodleFoldersCreation ||
Expand Down
2 changes: 2 additions & 0 deletions src/models/Event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ export enum Event {
PROPOSAL_UPDATED = 'PROPOSAL_UPDATED',
VISIT_CREATED = 'VISIT_CREATED',
VISIT_DELETED = 'VISIT_DELETED',
EXPERIMENT_CREATED = 'EXPERIMENT_CREATED',
EXPERIMENT_UPDATED = 'EXPERIMENT_UPDATED',
}
34 changes: 25 additions & 9 deletions src/models/ProposalMessage.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import { ProposalUser } from './../queue/consumers/scicat/scicatProposal/dto';
import { ProposalUser } from '../queue/consumers/scicat/scicatProposal/dto';

export type Instrument = {
id: number;
shortCode: string;
allocatedTime: number;
};

export type Sample = {
id: number;
title: string;
};

export interface InstrumentDto {
_id: string;
id: string;
Expand Down Expand Up @@ -34,16 +39,27 @@ export enum ProposalStatusDefaultShortCodes {
}

export type ProposalMessageData = {
proposalPk: number;
shortCode: string;
title: string;
abstract: string;
callId: number;
newStatus?: ProposalStatusDefaultShortCodes;
submitted: boolean;
instruments?: Instrument[];
members: ProposalUser[];
dataAccessUsers?: ProposalUser[];
visitors?: ProposalUser[];
dataAccessUsers: ProposalUser[];
visitors: ProposalUser[];
newStatus?: string;
proposalPk: number;
proposer?: ProposalUser;
instruments?: Instrument[];
shortCode: string;
title: string;
submitted: boolean;
samples?: Sample[];
};

export type ExperimentMessageData = {
experimentId: string;
experimentPk: number;
startsAt: Date;
endsAt: Date;
status: string;
proposal?: ProposalMessageData;
samples?: Sample[];
};
Loading
Loading