[#5741] use random string as id for non-system collections and fields

This commit is contained in:
Gani Georgiev
2024-10-29 20:08:16 +02:00
parent 658f0c4177
commit 5a94ec9918
9 changed files with 236 additions and 150 deletions
+8 -2
View File
@@ -182,9 +182,15 @@ func collectionTruncate(e *core.RequestEvent) error {
}
func collectionScaffolds(e *core.RequestEvent) error {
return e.JSON(http.StatusOK, map[string]*core.Collection{
collections := map[string]*core.Collection{
core.CollectionTypeBase: core.NewBaseCollection(""),
core.CollectionTypeAuth: core.NewAuthCollection(""),
core.CollectionTypeView: core.NewViewCollection(""),
})
}
for _, c := range collections {
c.Id = "" // clear autogenerated id
}
return e.JSON(http.StatusOK, collections)
}
+3 -1
View File
@@ -503,7 +503,7 @@ func TestCollectionCreate(t *testing.T) {
"emailChangeToken":{"duration":123},
"fields":[
{"type":"text","id":"12345789","name":"test"},
{"type":"text","name":"tokenKey","required":false,"min":10}
{"type":"text","name":"tokenKey","system":true,"required":false,"min":10}
]
}`),
Headers: map[string]string{
@@ -1409,6 +1409,8 @@ func TestCollectionScaffolds(t *testing.T) {
},
ExpectedStatus: 200,
ExpectedContent: []string{
`"id":""`,
`"name":""`,
`"auth":{`,
`"base":{`,
`"view":{`,