Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bai 1247 create a basic read only model #1282

Merged
merged 22 commits into from
Jun 4, 2024

Conversation

TT38665
Copy link
Member

@TT38665 TT38665 commented May 22, 2024

No description provided.

@@ -32,6 +32,9 @@ export async function createModel(user: UserInterface, modelParams: CreateModelP
})

const auth = await authorisation.model(user, model, ModelAction.Create)
if (model.settings.mirror.sourceModelId && model.settings.mirror.destinationModelId) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should move this check to the start of the function and check the contents of modelParams.settings

export async function updateModel(
user: UserInterface,
modelId: string,
modelDiff: Partial<UpdateModelParams>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not include settings in the model? What makes settings special?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah. Presumably because we only use Object.assign() below, which isn't recursive. I would prefer a recursive merging here, as opposed to treating 'settings' as a special case. I think something like:

.mergeWith({}, model, modelDiff, (a, b) => 
  _.isArray(b) ? b : undefined
);

Might work.

@TT38665 TT38665 merged commit 8b53693 into main Jun 4, 2024
14 checks passed
@TT38665 TT38665 deleted the BAI-1247-create-a-basic-read-only-model branch June 4, 2024 13:23
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.

3 participants