-
Notifications
You must be signed in to change notification settings - Fork 15
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
Add update model endpoint #739
Conversation
@@ -206,6 +206,20 @@ export async function updateModelCard( | |||
return revision | |||
} | |||
|
|||
export type UpdateModelParams = Pick<ModelInterface, 'name' | 'description' | 'visibility'> | |||
export async function updateModel(user: UserDoc, modelId: string, diff: Partial<UpdateModelParams>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the 'diff' stand for different/difference??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would assume so, a Partial is (like the name suggests) a type that contains some but not all of the properties of a given type.
I think we should probably rename this, but I am going to approve in case you're 100% set on this naming @a3957273
@@ -206,6 +206,20 @@ export async function updateModelCard( | |||
return revision | |||
} | |||
|
|||
export type UpdateModelParams = Pick<ModelInterface, 'name' | 'description' | 'visibility'> | |||
export async function updateModel(user: UserDoc, modelId: string, diff: Partial<UpdateModelParams>) { | |||
const model = await getModelById(user, modelId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why didn't you use findByIdAndUpdate()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to check the authorisation first.
No description provided.