Skip to content

Commit

Permalink
Remove implicated_systems from realm
Browse files Browse the repository at this point in the history
  • Loading branch information
clari182 committed Aug 30, 2024
1 parent 3167008 commit 1317be2
Show file tree
Hide file tree
Showing 12 changed files with 55 additions and 69 deletions.
6 changes: 3 additions & 3 deletions site/gatsby-site/playwright/seeds/aiidprod/incidents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const incidents: DBIncident[] = [
"Alleged harmed or nearly harmed parties": ["entity3"],
editors: ["user1"],
reports: [1],
implicated_systems: ["entity4"],
implicated_systems: ["entity1"],

// TODO: this aren't required but break the build if missing
nlp_similar_incidents: [],
Expand All @@ -33,7 +33,7 @@ const incidents: DBIncident[] = [
"Alleged harmed or nearly harmed parties": ["entity3"],
editors: ["user1"],
reports: [2],
implicated_systems: ["entity4"],
implicated_systems: ["entity1"],

// TODO: this aren't required but break the build if missing
nlp_similar_incidents: [],
Expand Down Expand Up @@ -89,7 +89,7 @@ const incidents: DBIncident[] = [
},
// this field is currently present in the database but not mapped to any graphql fueld
// "created_at": 1407974400000
implicated_systems: ["amazon"],
implicated_systems: ["entity1"],
},
]

Expand Down
2 changes: 1 addition & 1 deletion site/gatsby-site/playwright/seeds/aiidprod/submissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const submissions: DBSubmission[] = [
title: "Sample title",
url: "http://example.com",
user: "user1",
implicated_systems: ["entity4"]
implicated_systems: ["entity1"]
}
]

Expand Down
66 changes: 43 additions & 23 deletions site/gatsby-site/server/generated/graphql.ts

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions site/gatsby-site/server/tests/fixtures/submissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const submission1 = {
title: "Submission 1",
url: "http://example.com",
user: "user1",
implicated_systems: ["entity4"]
implicated_systems: ["entity1"]
}

const submission2 = {
Expand All @@ -62,7 +62,7 @@ const submission2 = {
title: "Submission 2",
url: "http://example.com",
user: "user1",
implicated_systems: ["entity4"]
implicated_systems: ["entity1"]
}

const submission3 = {
Expand All @@ -75,7 +75,7 @@ const submission3 = {
date_submitted: "2023-11-14T00:00:00.000Z",
deployers: ["entity3"],
description: "Another sample description",
developers: ["entity4"],
developers: ["entity1"],
harmed_parties: ["entity5"],
incident_editors: ["editor3"],
image_url: "https://sample_image_url_4.com",
Expand All @@ -87,7 +87,7 @@ const submission3 = {
title: "Submission 3",
url: "http://example.com",
user: "user1",
implicated_systems: ["entity4"]
implicated_systems: ["entity1"]
}


Expand Down
10 changes: 2 additions & 8 deletions site/gatsby-site/server/types/incidents.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { GraphQLFloat, GraphQLInt, GraphQLList, GraphQLNonNull, GraphQLObjectType, GraphQLString } from "graphql";
import { ObjectIdScalar } from "../scalars";
import { EntityType } from "./entity";
import { getListRelationshipConfig, getListRelationshipExtension, getListRelationshipResolver } from "../utils";
import { getListRelationshipConfig, getListRelationshipExtension, getListRelationshipResolver, getRelationshipConfig } from "../utils";
import { UserType } from "./user";
import { NlpSimilarIncidentType } from "../types";
import { ReportType } from "./report";
Expand Down Expand Up @@ -61,13 +61,7 @@ export const IncidentType = new GraphQLObjectType({
nlp_similar_incidents: { type: new GraphQLList(NlpSimilarIncidentType) },
reports: getListRelationshipConfig(ReportType, GraphQLInt, 'reports', 'report_number', 'reports', 'aiidprod'),
tsne: { type: TsneType },
implicated_systems: {
type: new GraphQLList(EntityType),
resolve: getListRelationshipResolver('implicated_systems', 'entity_id', EntityType, 'aiidprod', 'entities'),
extensions: {
relationship: getListRelationshipExtension('implicated_systems', 'entity_id', GraphQLString, 'aiidprod', 'entities')
},
},
implicated_systems: getListRelationshipConfig(EntityType, GraphQLString, 'implicated_systems', 'entity_id', 'aiidprod', 'entities'),
},
});

Expand Down
1 change: 1 addition & 0 deletions site/gatsby-site/src/components/submissions/schemas.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ export const incidentSchema = schema.shape({
description: description.required('*Description is required'),
incident_date: incident_date.required('*Incident Date required'),
incident_ids: yup.mixed(),
implicated_systems: yup.array().required('*Implicated Systems is required'),
});

export const reportSchema = schema.shape({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@
"foreign_key": "entity_id",
"is_list": true
},
"implicated_systems": {
"ref": "#/relationship/mongodb-atlas/aiidprod/entities",
"source_key": "implicated_systems",
"foreign_key": "entity_id",
"is_list": true
},
"editors": {
"ref": "#/relationship/mongodb-atlas/customData/users",
"source_key": "editors",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@
"bsonType": "string"
}
},
"implicated_systems": {
"bsonType": "array",
"items": {
"bsonType": "string"
}
},
"_id": {
"bsonType": "objectId"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,5 @@
"source_key": "user",
"foreign_key": "userId",
"is_list": false
},
"implicated_systems": {
"ref": "#/relationship/mongodb-atlas/aiidprod/entities",
"source_key": "implicated_systems",
"foreign_key": "entity_id",
"is_list": true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,6 @@
},
"quiet": {
"bsonType": "bool"
},
"implicated_systems": {
"bsonType": "array",
"items": {
"bsonType": "string"
}
}
},
"required": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@
"bsonType": "string"
}
},
"implicated_systems": {
"bsonType": "array",
"items": {
"bsonType": "string"
}
},
"_id": {
"bsonType": "objectId"
},
Expand Down
1 change: 1 addition & 0 deletions site/realm/functions/promoteSubmissionToReport.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ exports = async (input) => {
nlp_similar_incidents: submission.nlp_similar_incidents || [],
editor_similar_incidents: submission.editor_similar_incidents || [],
editor_dissimilar_incidents: submission.editor_dissimilar_incidents || [],
implicated_systems: submission.implicated_systems || [],
}
if (submission.embedding) {
newIncident.embedding = {
Expand Down

0 comments on commit 1317be2

Please sign in to comment.