From df9aa11d4402b57e1dda6f643dbac85eb6a2ddeb Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Sun, 15 Aug 2021 10:45:17 +0545 Subject: [PATCH 1/5] support hyphen and period in custom id component --- public/dist/scripts/app-all.js | 4 ++-- public/dist/scripts/app.js | 4 ++-- public/scripts/views/forms/custom-id.js | 4 +++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/public/dist/scripts/app-all.js b/public/dist/scripts/app-all.js index b0433ae497..37fa0222b1 100644 --- a/public/dist/scripts/app-all.js +++ b/public/dist/scripts/app-all.js @@ -2384,8 +2384,8 @@ element.setAttribute("data-id-type",idType);info.innerHTML="Appwrite will genera button.className=idType=="custom"?"icon-shuffle copy":"icon-edit copy";} const syncEditorWithID=function(event){if(element.value!=='unique()'||idType!='auto'){writer.value=element.value;} if(idType=='auto'){element.value='unique()';}} -const keypress=function(e){const key=e.which||e.keyCode;const ZERO=48;const NINE=57;const SMALL_A=97;const SMALL_Z=122;const CAPITAL_A=65;const CAPITAL_Z=90;const UNDERSCORE=95;const isNotValidDigit=keyNINE;const isNotValidSmallAlphabet=keySMALL_Z;const isNotValidCapitalAlphabet=keyCAPITAL_Z;if(key==UNDERSCORE&&e.target.value.length==0){e.preventDefault();} -if(key!=UNDERSCORE&&isNotValidDigit&&isNotValidSmallAlphabet&&isNotValidCapitalAlphabet){e.preventDefault();}} +const keypress=function(e){const key=e.which||e.keyCode;const ZERO=48;const NINE=57;const SMALL_A=97;const SMALL_Z=122;const CAPITAL_A=65;const CAPITAL_Z=90;const UNDERSCORE=95;const HYPHEN=45;const PERIOD=46;const isNotValidDigit=keyNINE;const isNotValidSmallAlphabet=keySMALL_Z;const isNotValidCapitalAlphabet=keyCAPITAL_Z;if(key==UNDERSCORE&&e.target.value.length==0){e.preventDefault();} +if(key!=UNDERSCORE&&key!=HYPHEN&&key!=PERIOD&&isNotValidDigit&&isNotValidSmallAlphabet&&isNotValidCapitalAlphabet){e.preventDefault();}} syncEditorWithID();setIdType(idType);writer.addEventListener("change",function(event){element.value=writer.value;});writer.form.addEventListener('reset',function(event){const resetEvent=new Event('reset');element.dispatchEvent(resetEvent);});element.addEventListener('reset',function(event){idType=element.getAttribute('data-id-type');setIdType(idType);});writer.addEventListener('keypress',keypress);button.addEventListener("click",switchType);}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-document",controller:function(element,container,search){var formsDocument=(element.dataset["formsDocument"]||'');var searchButton=(element.dataset["search"]||0);let path=container.scope(searchButton);element.addEventListener('click',function(){search.selected=element.value;search.path=path;document.dispatchEvent(new CustomEvent(formsDocument,{bubbles:false,cancelable:true}));});}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-document-preview",controller:function(element,container,search){element.addEventListener('change',function(){console.log(element.value);});}});})(window);(function(window){window.ls.container.get("view").add({selector:"data-forms-filter",controller:function(document,container,expression,element,form,di){let name=element.dataset["formsFilter"]||"";let events=element.dataset["event"]||"";let serialize=function(obj,prefix){let str=[],p;for(p in obj){if(obj.hasOwnProperty(p)){let k=prefix?prefix+"["+p+"]":p,v=obj[p];if(v===""){continue;} str.push(v!==null&&typeof v==="object"?serialize(v,k):encodeURIComponent(k)+"="+encodeURIComponent(v));}} return str.join("&");};let parse=function(filter){if(filter===""){return null;} diff --git a/public/dist/scripts/app.js b/public/dist/scripts/app.js index fbaf23c857..ef81cd86e8 100644 --- a/public/dist/scripts/app.js +++ b/public/dist/scripts/app.js @@ -368,8 +368,8 @@ element.setAttribute("data-id-type",idType);info.innerHTML="Appwrite will genera button.className=idType=="custom"?"icon-shuffle copy":"icon-edit copy";} const syncEditorWithID=function(event){if(element.value!=='unique()'||idType!='auto'){writer.value=element.value;} if(idType=='auto'){element.value='unique()';}} -const keypress=function(e){const key=e.which||e.keyCode;const ZERO=48;const NINE=57;const SMALL_A=97;const SMALL_Z=122;const CAPITAL_A=65;const CAPITAL_Z=90;const UNDERSCORE=95;const isNotValidDigit=keyNINE;const isNotValidSmallAlphabet=keySMALL_Z;const isNotValidCapitalAlphabet=keyCAPITAL_Z;if(key==UNDERSCORE&&e.target.value.length==0){e.preventDefault();} -if(key!=UNDERSCORE&&isNotValidDigit&&isNotValidSmallAlphabet&&isNotValidCapitalAlphabet){e.preventDefault();}} +const keypress=function(e){const key=e.which||e.keyCode;const ZERO=48;const NINE=57;const SMALL_A=97;const SMALL_Z=122;const CAPITAL_A=65;const CAPITAL_Z=90;const UNDERSCORE=95;const HYPHEN=45;const PERIOD=46;const isNotValidDigit=keyNINE;const isNotValidSmallAlphabet=keySMALL_Z;const isNotValidCapitalAlphabet=keyCAPITAL_Z;if(key==UNDERSCORE&&e.target.value.length==0){e.preventDefault();} +if(key!=UNDERSCORE&&key!=HYPHEN&&key!=PERIOD&&isNotValidDigit&&isNotValidSmallAlphabet&&isNotValidCapitalAlphabet){e.preventDefault();}} syncEditorWithID();setIdType(idType);writer.addEventListener("change",function(event){element.value=writer.value;});writer.form.addEventListener('reset',function(event){const resetEvent=new Event('reset');element.dispatchEvent(resetEvent);});element.addEventListener('reset',function(event){idType=element.getAttribute('data-id-type');setIdType(idType);});writer.addEventListener('keypress',keypress);button.addEventListener("click",switchType);}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-document",controller:function(element,container,search){var formsDocument=(element.dataset["formsDocument"]||'');var searchButton=(element.dataset["search"]||0);let path=container.scope(searchButton);element.addEventListener('click',function(){search.selected=element.value;search.path=path;document.dispatchEvent(new CustomEvent(formsDocument,{bubbles:false,cancelable:true}));});}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-document-preview",controller:function(element,container,search){element.addEventListener('change',function(){console.log(element.value);});}});})(window);(function(window){window.ls.container.get("view").add({selector:"data-forms-filter",controller:function(document,container,expression,element,form,di){let name=element.dataset["formsFilter"]||"";let events=element.dataset["event"]||"";let serialize=function(obj,prefix){let str=[],p;for(p in obj){if(obj.hasOwnProperty(p)){let k=prefix?prefix+"["+p+"]":p,v=obj[p];if(v===""){continue;} str.push(v!==null&&typeof v==="object"?serialize(v,k):encodeURIComponent(k)+"="+encodeURIComponent(v));}} return str.join("&");};let parse=function(filter){if(filter===""){return null;} diff --git a/public/scripts/views/forms/custom-id.js b/public/scripts/views/forms/custom-id.js index 304f780000..c6dd7e37b7 100644 --- a/public/scripts/views/forms/custom-id.js +++ b/public/scripts/views/forms/custom-id.js @@ -114,6 +114,8 @@ const CAPITAL_A = 65; const CAPITAL_Z = 90; const UNDERSCORE = 95; + const HYPHEN = 45; + const PERIOD = 46; const isNotValidDigit = key < ZERO || key > NINE; const isNotValidSmallAlphabet = key < SMALL_A || key > SMALL_Z; @@ -123,7 +125,7 @@ if (key == UNDERSCORE && e.target.value.length == 0) { e.preventDefault(); } - if (key != UNDERSCORE && isNotValidDigit && isNotValidSmallAlphabet && isNotValidCapitalAlphabet) { + if (key != UNDERSCORE && key != HYPHEN && key != PERIOD && isNotValidDigit && isNotValidSmallAlphabet && isNotValidCapitalAlphabet) { e.preventDefault(); } } From d76e079d2967fd89c849b04d7918fe0c9a81dca1 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Thu, 19 Aug 2021 10:21:02 +0545 Subject: [PATCH 2/5] custom id component - not allow leading special chars --- composer.json | 2 +- composer.lock | 44 ++++++++++++------------- public/dist/scripts/app-all.js | 6 ++-- public/dist/scripts/app.js | 6 ++-- public/scripts/views/forms/custom-id.js | 3 +- 5 files changed, 31 insertions(+), 30 deletions(-) diff --git a/composer.json b/composer.json index 76aa71cf7d..323cb3faf4 100644 --- a/composer.json +++ b/composer.json @@ -45,7 +45,7 @@ "utopia-php/cache": "0.4.*", "utopia-php/cli": "0.11.*", "utopia-php/config": "0.2.*", - "utopia-php/database": "0.7.*", + "utopia-php/database": "0.9.*", "utopia-php/locale": "0.4.*", "utopia-php/registry": "0.5.*", "utopia-php/preloader": "0.2.*", diff --git a/composer.lock b/composer.lock index db07f5df2b..ef7f5d2e03 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "7de5dc8a9fe3cbc14696c685d1cdddee", + "content-hash": "6489948fde57f58412fdda5737e5a77e", "packages": [ { "name": "adhocore/jwt", @@ -1666,22 +1666,22 @@ }, { "name": "utopia-php/abuse", - "version": "0.6.2", + "version": "0.6.3", "source": { "type": "git", "url": "https://github.com/utopia-php/abuse.git", - "reference": "4cd9c16610f7398d2e1737663ef682fa721ae736" + "reference": "d63e928c2c50b367495a499a85ba9806ee274c5e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/abuse/zipball/4cd9c16610f7398d2e1737663ef682fa721ae736", - "reference": "4cd9c16610f7398d2e1737663ef682fa721ae736", + "url": "https://api.github.com/repos/utopia-php/abuse/zipball/d63e928c2c50b367495a499a85ba9806ee274c5e", + "reference": "d63e928c2c50b367495a499a85ba9806ee274c5e", "shasum": "" }, "require": { "ext-pdo": "*", "php": ">=7.4", - "utopia-php/database": "0.7.*" + "utopia-php/database": ">=0.6 <1.0" }, "require-dev": { "phpunit/phpunit": "^9.4", @@ -1713,9 +1713,9 @@ ], "support": { "issues": "https://github.com/utopia-php/abuse/issues", - "source": "https://github.com/utopia-php/abuse/tree/0.6.2" + "source": "https://github.com/utopia-php/abuse/tree/0.6.3" }, - "time": "2021-08-13T07:52:34+00:00" + "time": "2021-08-16T18:38:31+00:00" }, { "name": "utopia-php/analytics", @@ -1774,22 +1774,22 @@ }, { "name": "utopia-php/audit", - "version": "0.6.2", + "version": "0.6.3", "source": { "type": "git", "url": "https://github.com/utopia-php/audit.git", - "reference": "2ec39a53eb98a5f9d230550ad56c7c04de5d77df" + "reference": "d79b467fbc7d03e5e02f12cdeb08761507a60ca0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/audit/zipball/2ec39a53eb98a5f9d230550ad56c7c04de5d77df", - "reference": "2ec39a53eb98a5f9d230550ad56c7c04de5d77df", + "url": "https://api.github.com/repos/utopia-php/audit/zipball/d79b467fbc7d03e5e02f12cdeb08761507a60ca0", + "reference": "d79b467fbc7d03e5e02f12cdeb08761507a60ca0", "shasum": "" }, "require": { "ext-pdo": "*", "php": ">=7.4", - "utopia-php/database": "0.7.*" + "utopia-php/database": ">=0.6 <1.0" }, "require-dev": { "phpunit/phpunit": "^9.3", @@ -1821,9 +1821,9 @@ ], "support": { "issues": "https://github.com/utopia-php/audit/issues", - "source": "https://github.com/utopia-php/audit/tree/0.6.2" + "source": "https://github.com/utopia-php/audit/tree/0.6.3" }, - "time": "2021-08-13T08:05:20+00:00" + "time": "2021-08-16T18:49:55+00:00" }, { "name": "utopia-php/cache", @@ -1984,16 +1984,16 @@ }, { "name": "utopia-php/database", - "version": "0.7.0", + "version": "0.9.0", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "46c4a99347397e362a9429826e1888b0aefb2056" + "reference": "f9b1836621df7e14300f1622cb8b8d6fcfedfdaf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/46c4a99347397e362a9429826e1888b0aefb2056", - "reference": "46c4a99347397e362a9429826e1888b0aefb2056", + "url": "https://api.github.com/repos/utopia-php/database/zipball/f9b1836621df7e14300f1622cb8b8d6fcfedfdaf", + "reference": "f9b1836621df7e14300f1622cb8b8d6fcfedfdaf", "shasum": "" }, "require": { @@ -2041,9 +2041,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/0.7.0" + "source": "https://github.com/utopia-php/database/tree/0.9.0" }, - "time": "2021-08-10T19:09:58+00:00" + "time": "2021-08-18T19:08:47+00:00" }, { "name": "utopia-php/domains", @@ -6278,5 +6278,5 @@ "platform-overrides": { "php": "8.0" }, - "plugin-api-version": "2.0.0" + "plugin-api-version": "2.1.0" } diff --git a/public/dist/scripts/app-all.js b/public/dist/scripts/app-all.js index da1b0c5936..0ef8851cb9 100644 --- a/public/dist/scripts/app-all.js +++ b/public/dist/scripts/app-all.js @@ -2128,7 +2128,7 @@ result+'")": '+ error);} if(debug){console.info("debug-ls-if result:",result);} paths=expression.getPaths();let prv=element.$lsSkip;element.$lsSkip=!result;if(!result){element.style.visibility="hidden";element.style.display="none";}else{element.style.removeProperty("display");element.style.removeProperty("visibility");} -if(prv===true&&element.$lsSkip===false){view.render(element);}};check();for(let i=0;iNINE;const isNotValidSmallAlphabet=keySMALL_Z;const isNotValidCapitalAlphabet=keyCAPITAL_Z;if(key==UNDERSCORE&&e.target.value.length==0){e.preventDefault();} -if(key!=UNDERSCORE&&isNotValidDigit&&isNotValidSmallAlphabet&&isNotValidCapitalAlphabet){e.preventDefault();}} +const keypress=function(e){const key=e.which||e.keyCode;const ZERO=48;const NINE=57;const SMALL_A=97;const SMALL_Z=122;const CAPITAL_A=65;const CAPITAL_Z=90;const UNDERSCORE=95;const HYPHEN=45;const PERIOD=46;const isNotValidDigit=keyNINE;const isNotValidSmallAlphabet=keySMALL_Z;const isNotValidCapitalAlphabet=keyCAPITAL_Z;const isNotValidFirstChar=(key===UNDERSCORE||key===HYPHEN||key===PERIOD);if(isNotValidFirstChar&&e.target.value.length==0){e.preventDefault();} +if(key!=UNDERSCORE&&key!=HYPHEN&&key!=PERIOD&&isNotValidDigit&&isNotValidSmallAlphabet&&isNotValidCapitalAlphabet){e.preventDefault();}} syncEditorWithID();setIdType(idType);writer.addEventListener("change",function(event){element.value=writer.value;});writer.form.addEventListener('reset',function(event){const resetEvent=new Event('reset');element.dispatchEvent(resetEvent);});element.addEventListener('reset',function(event){idType=element.getAttribute('data-id-type');setIdType(idType);});writer.addEventListener('keypress',keypress);button.addEventListener("click",switchType);}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-document",controller:function(element,container,search){var formsDocument=(element.dataset["formsDocument"]||'');var searchButton=(element.dataset["search"]||0);let path=container.scope(searchButton);element.addEventListener('click',function(){search.selected=element.value;search.path=path;document.dispatchEvent(new CustomEvent(formsDocument,{bubbles:false,cancelable:true}));});}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-duplications",controller:function(element){let validate=function(element){let duplication=0;let form=element.form;for(let i=0;i1){element.setCustomValidity("Duplicated value");} else{element.setCustomValidity("");}};element.addEventListener('change',function(event){validate(event.target)});element.addEventListener('focus',function(event){validate(event.target)});element.addEventListener('blur',function(event){validate(event.target)});}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-document-preview",controller:function(element,container,search){element.addEventListener('change',function(){console.log(element.value);});}});})(window);(function(window){window.ls.container.get("view").add({selector:"data-forms-filter",controller:function(document,container,expression,element,form,di){let name=element.dataset["formsFilter"]||"";let events=element.dataset["event"]||"";let serialize=function(obj,prefix){let str=[],p;for(p in obj){if(obj.hasOwnProperty(p)){let k=prefix?prefix+"["+p+"]":p,v=obj[p];if(v===""){continue;} diff --git a/public/dist/scripts/app.js b/public/dist/scripts/app.js index 40e17c2b54..ab4782b43f 100644 --- a/public/dist/scripts/app.js +++ b/public/dist/scripts/app.js @@ -111,7 +111,7 @@ result+'")": '+ error);} if(debug){console.info("debug-ls-if result:",result);} paths=expression.getPaths();let prv=element.$lsSkip;element.$lsSkip=!result;if(!result){element.style.visibility="hidden";element.style.display="none";}else{element.style.removeProperty("display");element.style.removeProperty("visibility");} -if(prv===true&&element.$lsSkip===false){view.render(element);}};check();for(let i=0;iNINE;const isNotValidSmallAlphabet=keySMALL_Z;const isNotValidCapitalAlphabet=keyCAPITAL_Z;if(key==UNDERSCORE&&e.target.value.length==0){e.preventDefault();} -if(key!=UNDERSCORE&&isNotValidDigit&&isNotValidSmallAlphabet&&isNotValidCapitalAlphabet){e.preventDefault();}} +const keypress=function(e){const key=e.which||e.keyCode;const ZERO=48;const NINE=57;const SMALL_A=97;const SMALL_Z=122;const CAPITAL_A=65;const CAPITAL_Z=90;const UNDERSCORE=95;const HYPHEN=45;const PERIOD=46;const isNotValidDigit=keyNINE;const isNotValidSmallAlphabet=keySMALL_Z;const isNotValidCapitalAlphabet=keyCAPITAL_Z;const isNotValidFirstChar=(key===UNDERSCORE||key===HYPHEN||key===PERIOD);if(isNotValidFirstChar&&e.target.value.length==0){e.preventDefault();} +if(key!=UNDERSCORE&&key!=HYPHEN&&key!=PERIOD&&isNotValidDigit&&isNotValidSmallAlphabet&&isNotValidCapitalAlphabet){e.preventDefault();}} syncEditorWithID();setIdType(idType);writer.addEventListener("change",function(event){element.value=writer.value;});writer.form.addEventListener('reset',function(event){const resetEvent=new Event('reset');element.dispatchEvent(resetEvent);});element.addEventListener('reset',function(event){idType=element.getAttribute('data-id-type');setIdType(idType);});writer.addEventListener('keypress',keypress);button.addEventListener("click",switchType);}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-document",controller:function(element,container,search){var formsDocument=(element.dataset["formsDocument"]||'');var searchButton=(element.dataset["search"]||0);let path=container.scope(searchButton);element.addEventListener('click',function(){search.selected=element.value;search.path=path;document.dispatchEvent(new CustomEvent(formsDocument,{bubbles:false,cancelable:true}));});}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-duplications",controller:function(element){let validate=function(element){let duplication=0;let form=element.form;for(let i=0;i1){element.setCustomValidity("Duplicated value");} else{element.setCustomValidity("");}};element.addEventListener('change',function(event){validate(event.target)});element.addEventListener('focus',function(event){validate(event.target)});element.addEventListener('blur',function(event){validate(event.target)});}});})(window);(function(window){"use strict";window.ls.container.get("view").add({selector:"data-forms-document-preview",controller:function(element,container,search){element.addEventListener('change',function(){console.log(element.value);});}});})(window);(function(window){window.ls.container.get("view").add({selector:"data-forms-filter",controller:function(document,container,expression,element,form,di){let name=element.dataset["formsFilter"]||"";let events=element.dataset["event"]||"";let serialize=function(obj,prefix){let str=[],p;for(p in obj){if(obj.hasOwnProperty(p)){let k=prefix?prefix+"["+p+"]":p,v=obj[p];if(v===""){continue;} diff --git a/public/scripts/views/forms/custom-id.js b/public/scripts/views/forms/custom-id.js index c6dd7e37b7..03d8a370ee 100644 --- a/public/scripts/views/forms/custom-id.js +++ b/public/scripts/views/forms/custom-id.js @@ -121,8 +121,9 @@ const isNotValidSmallAlphabet = key < SMALL_A || key > SMALL_Z; const isNotValidCapitalAlphabet = key < CAPITAL_A || key > CAPITAL_Z; + const isNotValidFirstChar = (key === UNDERSCORE || key === HYPHEN || key === PERIOD); //Leading underscore is prevented - if (key == UNDERSCORE && e.target.value.length == 0) { + if ( isNotValidFirstChar && e.target.value.length == 0) { e.preventDefault(); } if (key != UNDERSCORE && key != HYPHEN && key != PERIOD && isNotValidDigit && isNotValidSmallAlphabet && isNotValidCapitalAlphabet) { From 6048d371b2d2c3e7a78027a7ec8839b8461a427c Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Thu, 19 Aug 2021 10:25:16 +0545 Subject: [PATCH 3/5] custom id description --- app/controllers/api/projects.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index 4f8f148a7b..64d34eb68d 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -40,7 +40,7 @@ App::post('/v1/projects') ->label('sdk.response.code', Response::STATUS_CODE_CREATED) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_PROJECT) - ->param('projectId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string `unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, and underscore. Can\'t start with a leading underscore. Max length is 36 chars.') + ->param('projectId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string `unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, and non leading underscore, hyphen and dot. Max length is 36 chars.') ->param('name', null, new Text(128), 'Project name. Max length: 128 chars.') ->param('teamId', '', new UID(), 'Team unique ID.') ->param('description', '', new Text(256), 'Project description. Max length: 256 chars.', true) From 8cd3ac858790dccbedb24c2a23ac9587b8455632 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Thu, 19 Aug 2021 10:35:11 +0545 Subject: [PATCH 4/5] update custom id param description --- app/controllers/api/projects.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index 64d34eb68d..b83dff6d9e 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -40,7 +40,7 @@ App::post('/v1/projects') ->label('sdk.response.code', Response::STATUS_CODE_CREATED) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_PROJECT) - ->param('projectId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string `unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, and non leading underscore, hyphen and dot. Max length is 36 chars.') + ->param('projectId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string `unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') ->param('name', null, new Text(128), 'Project name. Max length: 128 chars.') ->param('teamId', '', new UID(), 'Team unique ID.') ->param('description', '', new Text(256), 'Project description. Max length: 256 chars.', true) From bc05c4d3a5bc2a3e572ff03c092bc13abf5cbe0b Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Thu, 19 Aug 2021 10:37:36 +0545 Subject: [PATCH 5/5] update custom id description on all services --- app/controllers/api/account.php | 2 +- app/controllers/api/database.php | 4 ++-- app/controllers/api/functions.php | 2 +- app/controllers/api/storage.php | 2 +- app/controllers/api/teams.php | 2 +- app/controllers/api/users.php | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index ef08805117..f03cadd126 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -43,7 +43,7 @@ App::post('/v1/account') ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_USER) ->label('abuse-limit', 10) - ->param('userId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string `unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, and underscore. Can\'t start with a leading underscore. Max length is 36 chars.') + ->param('userId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string `unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') ->param('email', '', new Email(), 'User email.') ->param('password', '', new Password(), 'User password. Must be between 6 to 32 chars.') ->param('name', '', new Text(128), 'User name. Max length: 128 chars.', true) diff --git a/app/controllers/api/database.php b/app/controllers/api/database.php index 9491093689..8e869362dd 100644 --- a/app/controllers/api/database.php +++ b/app/controllers/api/database.php @@ -135,7 +135,7 @@ App::post('/v1/database/collections') ->label('sdk.response.code', Response::STATUS_CODE_CREATED) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_COLLECTION) - ->param('collectionId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string `unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, and underscore. Can\'t start with a leading underscore. Max length is 36 chars.') + ->param('collectionId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string `unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') ->param('name', '', new Text(128), 'Collection name. Max length: 128 chars.') ->param('read', null, new Permissions(), 'An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.') ->param('write', null, new Permissions(), 'An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.') @@ -1103,7 +1103,7 @@ App::post('/v1/database/collections/:collectionId/documents') ->label('sdk.response.code', Response::STATUS_CODE_CREATED) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_DOCUMENT) - ->param('documentId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string `unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, and underscore. Can\'t start with a leading underscore. Max length is 36 chars.') + ->param('documentId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string `unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') ->param('collectionId', null, new UID(), 'Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/server/database#createCollection).') ->param('data', [], new JSON(), 'Document data as JSON object.') ->param('read', null, new Permissions(), 'An array of strings with read permissions. By default only the current user is granted with read permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.', true) diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index 1441707559..fbd27c47f3 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -39,7 +39,7 @@ App::post('/v1/functions') ->label('sdk.response.code', Response::STATUS_CODE_CREATED) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_FUNCTION) - ->param('functionId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string `unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, and underscore. Can\'t start with a leading underscore. Max length is 36 chars.') + ->param('functionId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string `unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') ->param('name', '', new Text(128), 'Function name. Max length: 128 chars.') ->param('execute', [], new ArrayList(new Text(64)), 'An array of strings with execution permissions. By default no user is granted with any execute permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.') ->param('runtime', '', new WhiteList(array_keys(Config::getParam('runtimes')), true), 'Execution runtime.') diff --git a/app/controllers/api/storage.php b/app/controllers/api/storage.php index 5a5c43de58..852287ce63 100644 --- a/app/controllers/api/storage.php +++ b/app/controllers/api/storage.php @@ -38,7 +38,7 @@ App::post('/v1/storage/files') ->label('sdk.response.code', Response::STATUS_CODE_CREATED) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_FILE) - ->param('fileId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string `unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, and underscore. Can\'t start with a leading underscore. Max length is 36 chars.') + ->param('fileId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string `unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') ->param('file', [], new File(), 'Binary file.', false) ->param('read', null, new ArrayList(new Text(64)), 'An array of strings with read permissions. By default only the current user is granted with read permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.', true) ->param('write', null, new ArrayList(new Text(64)), 'An array of strings with write permissions. By default only the current user is granted with write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.', true) diff --git a/app/controllers/api/teams.php b/app/controllers/api/teams.php index 569940c42e..da312f09cc 100644 --- a/app/controllers/api/teams.php +++ b/app/controllers/api/teams.php @@ -33,7 +33,7 @@ App::post('/v1/teams') ->label('sdk.response.code', Response::STATUS_CODE_CREATED) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_TEAM) - ->param('teamId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string `unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, and underscore. Can\'t start with a leading underscore. Max length is 36 chars.') + ->param('teamId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string `unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') ->param('name', null, new Text(128), 'Team name. Max length: 128 chars.') ->param('roles', ['owner'], new ArrayList(new Key()), 'Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](/docs/permissions). Max length for each role is 32 chars.', true) ->inject('response') diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index 11beca048b..65cbea01b1 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -30,7 +30,7 @@ App::post('/v1/users') ->label('sdk.response.code', Response::STATUS_CODE_CREATED) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_USER) - ->param('userId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string `unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, and underscore. Can\'t start with a leading underscore. Max length is 36 chars.') + ->param('userId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string `unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') ->param('email', '', new Email(), 'User email.') ->param('password', '', new Password(), 'User password. Must be between 6 to 32 chars.') ->param('name', '', new Text(128), 'User name. Max length: 128 chars.', true)