mirror of
https://github.com/pocketbase/pocketbase.git
synced 2026-10-17 03:28:15 +02:00
merge v0.23.0-rc changes
This commit is contained in:
1 parent
ad92992324
commit
844f18cac3
753 files changed
+85107
-63362
No files matched your search
@@ -1,9 +1,9 @@
|
||||
<script>
|
||||
import CodeBlock from "@/components/base/CodeBlock.svelte";
|
||||
import FieldsQueryParam from "@/components/collections/docs/FieldsQueryParam.svelte";
|
||||
import SdkTabs from "@/components/base/SdkTabs.svelte";
|
||||
import ApiClient from "@/utils/ApiClient";
|
||||
import CommonHelper from "@/utils/CommonHelper";
|
||||
import CodeBlock from "@/components/base/CodeBlock.svelte";
|
||||
import SdkTabs from "@/components/collections/docs/SdkTabs.svelte";
|
||||
import FieldsQueryParam from "@/components/collections/docs/FieldsQueryParam.svelte";
|
||||
|
||||
export let collection;
|
||||
|
||||
@@ -13,9 +13,16 @@
|
||||
|
||||
$: isAuth = collection?.type === "auth";
|
||||
|
||||
$: adminsOnly = collection?.updateRule === null;
|
||||
$: superusersOnly = collection?.updateRule === null;
|
||||
|
||||
$: backendAbsUrl = CommonHelper.getApiExampleUrl(ApiClient.baseUrl);
|
||||
$: excludedTableFields = isAuth ? ["id", "password", "verified", "email", "emailVisibility"] : ["id"];
|
||||
|
||||
$: tableFields =
|
||||
collection?.fields?.filter((f) => {
|
||||
return !f.hidden && f.type != "autodate" && !excludedTableFields.includes(f.name);
|
||||
}) || [];
|
||||
|
||||
$: backendAbsUrl = CommonHelper.getApiExampleUrl(ApiClient.baseURL);
|
||||
|
||||
$: responses = [
|
||||
{
|
||||
@@ -29,7 +36,7 @@
|
||||
"code": 400,
|
||||
"message": "Failed to update record.",
|
||||
"data": {
|
||||
"${collection?.schema?.[0]?.name}": {
|
||||
"${collection?.fields?.[0]?.name}": {
|
||||
"code": "validation_required",
|
||||
"message": "Missing required value."
|
||||
}
|
||||
@@ -59,10 +66,8 @@
|
||||
},
|
||||
];
|
||||
|
||||
$: if (collection.type === "auth") {
|
||||
$: if (isAuth) {
|
||||
baseData = {
|
||||
username: "test_username_update",
|
||||
emailVisibility: false,
|
||||
password: "87654321",
|
||||
passwordConfirm: "87654321",
|
||||
oldPassword: "12345678",
|
||||
@@ -108,7 +113,7 @@ const pb = new PocketBase('${backendAbsUrl}');
|
||||
...
|
||||
|
||||
// example update data
|
||||
const data = ${JSON.stringify(Object.assign({}, baseData, CommonHelper.dummyCollectionSchemaData(collection)), null, 4)};
|
||||
const data = ${JSON.stringify(Object.assign({}, baseData, CommonHelper.dummyCollectionSchemaData(collection, true)), null, 4)};
|
||||
|
||||
const record = await pb.collection('${collection?.name}').update('RECORD_ID', data);
|
||||
`}
|
||||
@@ -120,7 +125,7 @@ final pb = PocketBase('${backendAbsUrl}');
|
||||
...
|
||||
|
||||
// example update body
|
||||
final body = <String, dynamic>${JSON.stringify(Object.assign({}, baseData, CommonHelper.dummyCollectionSchemaData(collection)), null, 2)};
|
||||
final body = <String, dynamic>${JSON.stringify(Object.assign({}, baseData, CommonHelper.dummyCollectionSchemaData(collection, true)), null, 2)};
|
||||
|
||||
final record = await pb.collection('${collection?.name}').update('RECORD_ID', body: body);
|
||||
`}
|
||||
@@ -134,8 +139,8 @@ final record = await pb.collection('${collection?.name}').update('RECORD_ID', bo
|
||||
/api/collections/<strong>{collection.name}</strong>/records/<strong>:id</strong>
|
||||
</p>
|
||||
</div>
|
||||
{#if adminsOnly}
|
||||
<p class="txt-hint txt-sm txt-right">Requires admin <code>Authorization:TOKEN</code> header</p>
|
||||
{#if superusersOnly}
|
||||
<p class="txt-hint txt-sm txt-right">Requires superuser <code>Authorization:TOKEN</code> header</p>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -171,19 +176,7 @@ final record = await pb.collection('${collection?.name}').update('RECORD_ID', bo
|
||||
<tbody>
|
||||
{#if isAuth}
|
||||
<tr>
|
||||
<td colspan="3" class="txt-hint">Auth fields</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="inline-flex">
|
||||
<span class="label label-warning">Optional</span>
|
||||
<span>username</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<span class="label">String</span>
|
||||
</td>
|
||||
<td>The username of the auth record.</td>
|
||||
<td colspan="3" class="txt-hint txt-bold">Auth specific fields</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
@@ -198,7 +191,7 @@ final record = await pb.collection('${collection?.name}').update('RECORD_ID', bo
|
||||
<td>
|
||||
The auth record email address.
|
||||
<br />
|
||||
This field can be updated only by admins or auth records with "Manage" access.
|
||||
This field can be updated only by superusers or auth records with "Manage" access.
|
||||
<br />
|
||||
Regular accounts can update their email by calling "Request email change".
|
||||
</td>
|
||||
@@ -206,7 +199,11 @@ final record = await pb.collection('${collection?.name}').update('RECORD_ID', bo
|
||||
<tr>
|
||||
<td>
|
||||
<div class="inline-flex">
|
||||
<span class="label label-warning">Optional</span>
|
||||
{#if collection?.fields?.find((f) => f.name == "emailVisibility")?.required}
|
||||
<span class="label label-success">Required</span>
|
||||
{:else}
|
||||
<span class="label label-warning">Optional</span>
|
||||
{/if}
|
||||
<span>emailVisibility</span>
|
||||
</div>
|
||||
</td>
|
||||
@@ -228,8 +225,8 @@ final record = await pb.collection('${collection?.name}').update('RECORD_ID', bo
|
||||
<td>
|
||||
Old auth record password.
|
||||
<br />
|
||||
This field is required only when changing the record password. Admins and auth records with
|
||||
"Manage" access can skip this field.
|
||||
This field is required only when changing the record password. Superusers and auth records
|
||||
with "Manage" access can skip this field.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -269,15 +266,15 @@ final record = await pb.collection('${collection?.name}').update('RECORD_ID', bo
|
||||
<td>
|
||||
Indicates whether the auth record is verified or not.
|
||||
<br />
|
||||
This field can be set only by admins or auth records with "Manage" access.
|
||||
This field can be set only by superusers or auth records with "Manage" access.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" class="txt-hint">Schema fields</td>
|
||||
<td colspan="3" class="txt-hint txt-bold">Other fields</td>
|
||||
</tr>
|
||||
{/if}
|
||||
|
||||
{#each collection?.schema as field (field.name)}
|
||||
{#each tableFields as field (field.name)}
|
||||
<tr>
|
||||
<td>
|
||||
<div class="inline-flex">
|
||||
@@ -307,9 +304,7 @@ final record = await pb.collection('${collection?.name}').update('RECORD_ID', bo
|
||||
File object.<br />
|
||||
Set to <code>null</code> to delete already uploaded file(s).
|
||||
{:else if field.type === "relation"}
|
||||
Relation record {field.options?.maxSelect > 1 ? "ids" : "id"}.
|
||||
{:else if field.type === "user"}
|
||||
User {field.options?.maxSelect > 1 ? "ids" : "id"}.
|
||||
Relation record {field.maxSelect == 1 ? "id" : "ids"}.
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in new issue
Block a user