Skip to content

feat: update instrument_sessions subgraph to test#16

Open
mattprit-test[bot] wants to merge 1 commit into
mainfrom
instrument_sessions-test
Open

feat: update instrument_sessions subgraph to test#16
mattprit-test[bot] wants to merge 1 commit into
mainfrom
instrument_sessions-test

Conversation

@mattprit-test
Copy link
Copy Markdown

@mattprit-test mattprit-test Bot commented May 29, 2025

Repository

Subgraph maintainers

@DiamondLightSource/ulims

@github-actions
Copy link
Copy Markdown

@@ -20,6 +20,36 @@ directive @join__unionMember(graph: join__Graph!, member: String!) repeatable on
 
 directive @link(url: String, as: String, for: link__Purpose, import: [link__Import]) repeatable on SCHEMA
 
+type Account
+  @join__type(graph: INSTRUMENT_SESSIONS)
+{
+  accountId: Int!
+  username: String!
+  emailAddress: String
+  title: String
+  givenName: String
+  familyName: String
+  type: AccountType!
+  state: AccountState!
+  proposalRoles: [ProposalAccount!]!
+  instrumentSessionRoles: [InstrumentSessionRole!]!
+}
+
+enum AccountState
+  @join__type(graph: INSTRUMENT_SESSIONS)
+{
+  enabled @join__enumValue(graph: INSTRUMENT_SESSIONS)
+  disabled @join__enumValue(graph: INSTRUMENT_SESSIONS)
+}
+
+enum AccountType
+  @join__type(graph: INSTRUMENT_SESSIONS)
+{
+  user @join__enumValue(graph: INSTRUMENT_SESSIONS)
+  staff @join__enumValue(graph: INSTRUMENT_SESSIONS)
+  functional @join__enumValue(graph: INSTRUMENT_SESSIONS)
+}
+
 type Artifact
   @join__type(graph: WORKFLOWS)
 {
@@ -33,17 +63,49 @@ type Artifact
   mimeType: String!
 }
 
-"""
-Implement the DateTime<Utc> scalar
-
-The input/output is a string in RFC3339 format.
-"""
+"""Date with time (isoformat)"""
 scalar DateTime
+  @join__type(graph: INSTRUMENT_SESSIONS)
   @join__type(graph: WORKFLOWS)
 
+type Instrument
+  @join__type(graph: INSTRUMENT_SESSIONS)
+{
+  name: String!
+  scienceGroup: String
+  description: String
+  proposals: [Proposal!]!
+  instrumentSessions: [InstrumentSession!]!
+}
+
+type InstrumentSession
+  @join__type(graph: INSTRUMENT_SESSIONS)
+{
+  instrumentSessionId: Int!
+  instrumentSessionNumber: Int!
+  startTime: DateTime
+  endTime: DateTime
+  type: String
+  state: String
+  riskRating: String
+  proposal: Proposal
+  instrument: Instrument!
+  roles: [InstrumentSessionRole!]!
+}
+
+type InstrumentSessionRole
+  @join__type(graph: INSTRUMENT_SESSIONS)
+{
+  instrumentSession: InstrumentSession!
+  account: Account!
+  role: String!
+  onSite: Boolean!
+}
+
 scalar join__FieldSet
 
 enum join__Graph {
+  INSTRUMENT_SESSIONS @join__graph(name: "instrument_sessions", url: "https://instrument-sessions.diamond.ac.uk/api/graphql")
   WORKFLOWS @join__graph(name: "workflows", url: "https://workflows.diamond.ac.uk/graphql")
 }
 
@@ -93,15 +155,66 @@ type PageInfo
   endCursor: String
 }
 
+type Proposal
+  @join__type(graph: INSTRUMENT_SESSIONS)
+{
+  proposalNumber: Int!
+  proposalCategory: String
+  title: String
+  summary: String
+  state: ProposalState!
+  instrumentSessions: [InstrumentSession!]!
+  instruments: [Instrument!]!
+  roles: [ProposalAccount!]!
+}
+
+type ProposalAccount
+  @join__type(graph: INSTRUMENT_SESSIONS)
+{
+  proposal: Proposal!
+  account: Account!
+  role: String!
+}
+
+enum ProposalState
+  @join__type(graph: INSTRUMENT_SESSIONS)
+{
+  Open @join__enumValue(graph: INSTRUMENT_SESSIONS)
+  Closed @join__enumValue(graph: INSTRUMENT_SESSIONS)
+  Cancelled @join__enumValue(graph: INSTRUMENT_SESSIONS)
+}
+
 """The root query of the service"""
 type Query
+  @join__type(graph: INSTRUMENT_SESSIONS)
   @join__type(graph: WORKFLOWS)
 {
+  """Get a proposal by its number"""
+  proposal(proposalNumber: Int!): Proposal @join__field(graph: INSTRUMENT_SESSIONS)
+
+  """Get a list of proposals"""
+  proposals(proposalCategory: String = null): [Proposal!]! @join__field(graph: INSTRUMENT_SESSIONS)
+
+  """Get a instrument session"""
+  instrumentSession(proposalNumber: Int!, instrumentSessionNumber: Int!): InstrumentSession @join__field(graph: INSTRUMENT_SESSIONS)
+
+  """Get a instrument session"""
+  instrumentSessions(proposalNumber: Int = null, proposalCategory: String = null): [InstrumentSession!] @join__field(graph: INSTRUMENT_SESSIONS)
+
+  """Get an instrument"""
+  instrument(instrumentName: String!): Instrument @join__field(graph: INSTRUMENT_SESSIONS)
+
+  """Get a list of instruments"""
+  instruments(scienceGroup: String = null): [Instrument!]! @join__field(graph: INSTRUMENT_SESSIONS)
+
+  """Get an account"""
+  account(username: String!): Account @join__field(graph: INSTRUMENT_SESSIONS)
+
   """Get a single [`Workflow`] by proposal, visit, and name"""
-  workflow(visit: VisitInput!, name: String!): Workflow!
-  workflows(visit: VisitInput!, cursor: String, limit: Int, filter: WorkflowFilter): WorkflowConnection!
-  workflowTemplate(name: String!): WorkflowTemplate!
-  workflowTemplates(cursor: String, limit: Int): WorkflowTemplateConnection!
+  workflow(visit: VisitInput!, name: String!): Workflow! @join__field(graph: WORKFLOWS)
+  workflows(visit: VisitInput!, cursor: String, limit: Int, filter: WorkflowFilter): WorkflowConnection! @join__field(graph: WORKFLOWS)
+  workflowTemplate(name: String!): WorkflowTemplate! @join__field(graph: WORKFLOWS)
+  workflowTemplates(cursor: String, limit: Int): WorkflowTemplateConnection! @join__field(graph: WORKFLOWS)
 }
 
 type Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants