From e448c828a23020798875ce1ee19be1640cf5a09d Mon Sep 17 00:00:00 2001 From: David Refsnes Date: Fri, 16 Oct 2026 14:33:11 +0200 Subject: [PATCH] Fixed typeDefs.ts error --- backend/src/graphql/typeDefs.ts | 91 +++++++++++++++++++++++++++++++-- 1 file changed, 86 insertions(+), 5 deletions(-) diff --git a/backend/src/graphql/typeDefs.ts b/backend/src/graphql/typeDefs.ts index c2643ef..da5e30a 100644 --- a/backend/src/graphql/typeDefs.ts +++ b/backend/src/graphql/typeDefs.ts @@ -7,8 +7,22 @@ * mens selve implementasjonen ligger i resolvers/. */ -export const typeDefs = `#graphql + + + + +/** +* typeDefs beskriver hvilke operasjoner frontend +* har lov til å spørre GraphQL-API-et om. +* +* Det kan sammenlignes med et interface/kontrakt: +* vi definerer hvilke typer og operasjoner som finnes, +* mens selve implementasjonen ligger i resolvers/. +*/ + +export const typeDefs = `#graphql + # Beskriver hvordan et ThreatActor-objekt ser ut type ThreatActorGrid { name: String! @@ -18,8 +32,51 @@ export const typeDefs = `#graphql country: String! motivation: String! } + + type ThreatActorGridInfo { + items: [ThreatActorGrid!]! + totalCount: Int! + } + + type AssociatedItem { + mitreId: String! + name: String! + } + + type AssociatedItemsPage { + items: [AssociatedItem!]! + totalCount: Int! + } + + type ThreatActorDetailed { + threatId: String! + mitreId: String! + name: String! + description: String! + threatEntryCreated: String! + country: String! + motivation: String! + region: String! + firstSeen: String! + lastSeen: String! + status: String! + dangerLevel: String! + xMitreDeprecated: Boolean! + + aliases: [String!]! + sectors: [String!]! + } + + type Technique { + mitreId: String! + name: String! + description: String! + } - + type RelatedSoftwareEntity { + id: String! + mitreId: String! + name: String! } type Software { @@ -33,12 +90,36 @@ export const typeDefs = `#graphql associatedTechniques: [RelatedSoftwareEntity!]! usedByThreatActors: [RelatedSoftwareEntity!]! } - - # Operasjoner frontend kan spørre API-et om + type Query { - + ######################################## ThreatActors vvvv + + # Henter alle threat actors som trengs i grid + allThreatActorsGrid(limit: Int!, offset: Int!): ThreatActorGridInfo! + + # Henter alt nødvending info for ThreatActorDetailed i frontend + getThreatActorByMitreId(mitreId: String!): ThreatActorDetailed + + getThreatActorTechniques(mitreId: String!, limit: Int!, offset: Int!): AssociatedItemsPage! + + getThreatActorSoftwares(mitreId: String!, limit: Int!, offset: Int!): AssociatedItemsPage! + + ######################################## Techinques vvvv + + # Henter alle Techniques allTechniques: [Technique!]! + + # Henter én Technique basert på MITRE-ID techniqueByMitreId(mitreId: String!): Technique + + + ######################################## Software vvvv + software: [Software!]! + softwareByMitreId(mitreId: String!): Software + ######################################## Tactics vvvv + + } + `; \ No newline at end of file