-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into feature/BAI-1627-migr…
…ate-scans-to-have-their-own-mongo-collection
- Loading branch information
Showing
46 changed files
with
1,895 additions
and
4,778 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
ipython==8.32.0 | ||
ipython==9.0.1 | ||
myst_parser==4.0.1 | ||
nbsphinx==0.9.6 | ||
sphinx==8.1.3 | ||
sphinx==8.2.3 | ||
sphinx-copybutton==0.5.2 | ||
sphinx-rtd-theme==3.0.2 |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
backend/src/routes/v2/model/roles/getAllModelReviewRoles.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import bodyParser from 'body-parser' | ||
import { Request, Response } from 'express' | ||
|
||
import { Role, RoleKind } from '../../../../types/types.js' | ||
|
||
interface GetModelCurrentUserRolesResponse { | ||
roles: Array<Role> | ||
} | ||
|
||
export const getAllModelReviewRoles = [ | ||
bodyParser.json(), | ||
async (_req: Request, res: Response<GetModelCurrentUserRolesResponse>) => { | ||
return res.json({ | ||
roles: [ | ||
{ | ||
id: 'msro', | ||
name: 'Model Senior Responsible Officer', | ||
short: 'MSRO', | ||
kind: RoleKind.SCHEMA, | ||
description: 'This role is specified by the schema in accordance with its policy.', | ||
}, | ||
{ | ||
id: 'mtr', | ||
name: 'Model Technical Reviewer', | ||
short: 'MTR', | ||
kind: RoleKind.SCHEMA, | ||
description: 'This role is specified by the schema in accordance with its policy.', | ||
}, | ||
], | ||
}) | ||
}, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import AccessRequestModel from '../models/AccessRequest.js' | ||
import FileModel from '../models/File.js' | ||
import InferenceModel from '../models/Inference.js' | ||
import ModelModel from '../models/Model.js' | ||
import ModelCardRevisionModel from '../models/ModelCardRevision.js' | ||
import ReleaseModel from '../models/Release.js' | ||
import ResponseModel from '../models/Response.js' | ||
import ReviewModel from '../models/Review.js' | ||
import WebhookModel from '../models/Webhook.js' | ||
import log from '../services/log.js' | ||
import { connectToMongoose } from '../utils/database.js' | ||
|
||
async function script() { | ||
const modelId = process.argv.slice(2) | ||
|
||
if (!modelId || !process.argv[2]) { | ||
log.error('No model ID option. Please use format "npm run script -- modelSoftDelete <model-id>"') | ||
return | ||
} | ||
|
||
await connectToMongoose() | ||
|
||
const model = await ModelModel.findOne({ id: modelId }) | ||
if (!model) { | ||
log.error(`Cannot find model using ID ${modelId}`) | ||
return | ||
} | ||
const releases = await ReleaseModel.find({ modelId }) | ||
log.info(`Deleting ${releases.length} releases`) | ||
for (const release of releases) { | ||
await release.delete() | ||
} | ||
|
||
const accesses = await AccessRequestModel.find({ modelId }) | ||
log.info(`Deleting ${accesses.length} access requests`) | ||
for (const access of accesses) { | ||
await access.delete() | ||
} | ||
|
||
const revisions = await ModelCardRevisionModel.find({ modelId }) | ||
log.info(`Deleting ${revisions.length} model card revisions`) | ||
for (const revision of revisions) { | ||
await revision.delete() | ||
} | ||
|
||
const reviews = await ReviewModel.find({ modelId }) | ||
log.info(`Deleting ${reviews.length} reviews`) | ||
for (const review of reviews) { | ||
const responses = await ResponseModel.find({ parentId: review._id }) | ||
log.info(`Deleting ${responses.length} responses from review ${review._id} `) | ||
for (const response of responses) { | ||
await response.delete() | ||
} | ||
await review.delete() | ||
} | ||
|
||
const files = await FileModel.find({ modelId }) | ||
log.info(`Deleting ${accesses.length} files`) | ||
for (const file of files) { | ||
await file.delete() | ||
} | ||
|
||
const webhooks = await WebhookModel.find({ modelId }) | ||
log.info(`Deleting ${webhooks.length} webhooks`) | ||
for (const webhook of webhooks) { | ||
await webhook.delete() | ||
} | ||
|
||
const inferences = await InferenceModel.find({ modelId }) | ||
log.info(`Deleting ${inferences.length} inferences`) | ||
for (const inference of inferences) { | ||
await inference.delete() | ||
} | ||
|
||
await model.delete() | ||
return | ||
} | ||
|
||
script() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.