mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-01 05:14:25 +00:00
fix(ui): prevent edits and validate read-only metadata fields
This commit is contained in:
@@ -264,6 +264,13 @@ export class MetadataService {
|
||||
|
||||
await this.client.$transaction(async (tx) => {
|
||||
for (const req of reqs) {
|
||||
const field = await tx.metadataField.findUnique({
|
||||
where: { key: req.key },
|
||||
})
|
||||
if (field?.readOnly) {
|
||||
throw new Error(`Field ${field.key} is read-only`)
|
||||
}
|
||||
|
||||
const value = req.value
|
||||
let stringValue: string | null = null
|
||||
let numberValue: number | null = null
|
||||
|
||||
Reference in New Issue
Block a user