-<%_ if (isGraphQL) { _%>
+<%_ if (isGraphQL || answers["data-provider"] === "data-provider-appwrite") { _%>
@@ -108,6 +108,10 @@ export default function BlogPostShow() {
{new Date(record?.created_at).toLocaleString(undefined, {
timeZone: "UTC",
})}
+<%_ } else if (answers["data-provider"] === "data-provider-appwrite") { _%>
+ {new Date(record?.$createdAt).toLocaleString(undefined, {
+ timeZone: "UTC",
+ })}
<%_ } else { _%>
{new Date(record?.createdAt).toLocaleString(undefined, {
timeZone: "UTC",
diff --git a/refine-nextjs/plugins/mui-example/src/app/blog-posts/create/page.tsx b/refine-nextjs/plugins/mui-example/src/app/blog-posts/create/page.tsx
index 807bf90b8..ebbbe6317 100644
--- a/refine-nextjs/plugins/mui-example/src/app/blog-posts/create/page.tsx
+++ b/refine-nextjs/plugins/mui-example/src/app/blog-posts/create/page.tsx
@@ -118,10 +118,17 @@ export default function BlogPostCreate() {
label={"Category"}
margin="normal"
variant="outlined"
+<%_ if (answers["data-provider"] === "data-provider-appwrite") { _%>
+ error={!!(errors as any)?.<%- blogPostCategoryFieldName %>}
+ helperText={
+ (errors as any)?.<%- blogPostCategoryFieldName %>?.message
+ }
+<%_ } else { _%>
error={!!(errors as any)?.<%- blogPostCategoryFieldName %>?.id}
helperText={
(errors as any)?.<%- blogPostCategoryFieldName %>?.id?.message
}
+<%_ } _%>
required
/>
)}
diff --git a/refine-nextjs/plugins/mui-example/src/app/blog-posts/edit/[id]/page.tsx b/refine-nextjs/plugins/mui-example/src/app/blog-posts/edit/[id]/page.tsx
index ef4cf10d8..4b4948ba6 100644
--- a/refine-nextjs/plugins/mui-example/src/app/blog-posts/edit/[id]/page.tsx
+++ b/refine-nextjs/plugins/mui-example/src/app/blog-posts/edit/[id]/page.tsx
@@ -49,6 +49,20 @@ export default function BlogPostEdit() {
select: '*, categories(id,title)',
},
},
+<%_ } _%>
+<%_ if (answers["data-provider"] === "data-provider-appwrite") { _%>
+ refineCoreProps: {
+ queryOptions: {
+ select: ({ data }) => {
+ return {
+ data: {
+ ...data,
+ category: data.category.$id,
+ },
+ };
+ },
+ },
+ },
<%_ } _%>
});
@@ -56,7 +70,11 @@ export default function BlogPostEdit() {
const { autocompleteProps: categoryAutocompleteProps } = useAutocomplete({
resource: "categories",
+<%_ if (answers["data-provider"] === "data-provider-appwrite") { _%>
+ defaultValue: blogPostsData?.<%- blogPostCategoryFieldName %>,
+<%_ } else { _%>
defaultValue: blogPostsData?.<%- blogPostCategoryFieldName %>?.id,
+<%_ } _%>
<%_ if (answers["data-provider"] === "data-provider-hasura") { _%>
meta: {
fields: BLOG_POSTS_CATEGORIES_SELECT_QUERY,
@@ -122,10 +140,17 @@ export default function BlogPostEdit() {
label={"Category"}
margin="normal"
variant="outlined"
+<%_ if (answers["data-provider"] === "data-provider-appwrite") { _%>
+ error={!!(errors as any)?.<%- blogPostCategoryFieldName %>}
+ helperText={
+ (errors as any)?.<%- blogPostCategoryFieldName %>?.message
+ }
+<%_ } else { _%>
error={!!(errors as any)?.<%- blogPostCategoryFieldName %>?.id}
helperText={
(errors as any)?.<%- blogPostCategoryFieldName %>?.id?.message
}
+<%_ } _%>
required
/>
)}
diff --git a/refine-nextjs/plugins/mui-example/src/app/blog-posts/page.tsx b/refine-nextjs/plugins/mui-example/src/app/blog-posts/page.tsx
index 2e525c01e..d1e3bddbd 100644
--- a/refine-nextjs/plugins/mui-example/src/app/blog-posts/page.tsx
+++ b/refine-nextjs/plugins/mui-example/src/app/blog-posts/page.tsx
@@ -44,7 +44,7 @@ export default function BlogPostList() {
<%_ } _%>
});
-<%_ if (!isGraphQL) { _%>
+<%_ if (!isGraphQL && answers["data-provider"] !== "data-provider-appwrite") { _%>
const { data: categoryData, isLoading: categoryIsLoading } = useMany({
resource: "categories",
ids: dataGridProps?.rows?.map((item: any) => item?.<%- blogPostCategoryFieldName %>?.id).filter(Boolean) ?? [],
@@ -71,7 +71,7 @@ export default function BlogPostList() {
{
field: "content",
flex: 1,
- headerName: "content",
+ headerName: "Content",
minWidth: 250,
renderCell: function render({ value }) {
if (!value) return '-'
@@ -85,7 +85,7 @@ export default function BlogPostList() {
flex: 1,
headerName: "Category",
minWidth: 300,
- <%_ if (isGraphQL) { _%>
+ <%_ if (isGraphQL || answers["data-provider"] === "data-provider-appwrite") { _%>
valueGetter: ({ row }) => {
const value = row?.<%- blogPostCategoryFieldName %>?.title
return value
@@ -112,7 +112,9 @@ export default function BlogPostList() {
},
{
<%_ if (answers["data-provider"] === "data-provider-hasura") { _%>
- field: "created_at",
+ field: "created_at",
+<%_ } else if (answers["data-provider"] === "data-provider-appwrite") { _%>
+ field: "$createdAt",
<%_ } else { _%>
field: "createdAt",
<%_ } _%>
@@ -141,7 +143,7 @@ export default function BlogPostList() {
minWidth: 80,
},
],
- <%_ if (isGraphQL) { _%>
+ <%_ if (isGraphQL || answers["data-provider"] === "data-provider-appwrite") { _%>
[],
<%_ } else { _%>
[categoryData],
diff --git a/refine-nextjs/plugins/mui-example/src/app/blog-posts/show/[id]/page.tsx b/refine-nextjs/plugins/mui-example/src/app/blog-posts/show/[id]/page.tsx
index f0d9c4686..bfe3ce71c 100644
--- a/refine-nextjs/plugins/mui-example/src/app/blog-posts/show/[id]/page.tsx
+++ b/refine-nextjs/plugins/mui-example/src/app/blog-posts/show/[id]/page.tsx
@@ -46,7 +46,7 @@ export default function BlogPostShow() {
const record = data?.data;
-<%_ if (!isGraphQL) { _%>
+<%_ if (!isGraphQL && answers["data-provider"] !== "data-provider-appwrite") { _%>
const { data: categoryData, isLoading: categoryIsLoading } = useOne({
resource: "categories",
id: record?.<%- blogPostCategoryFieldName %>?.id || "",
@@ -77,16 +77,15 @@ export default function BlogPostShow() {
{"Category"}
-<%_ if (isGraphQL) { _%>
-
{record?.<%- blogPostCategoryFieldName %>?.title}
+<%_ if (isGraphQL || answers["data-provider"] === "data-provider-appwrite") { _%>
+
{record?.<%- blogPostCategoryFieldName %>?.title}
<%_ } else { _%>
- {categoryIsLoading ? (
- <>Loading...>
- ) : (
- <>{categoryData?.data?.title}>
- )}
+ {categoryIsLoading ? (
+ <>Loading...>
+ ) : (
+ <>{categoryData?.data?.title}>
+ )}
<%_ } _%>
-
{"Status"}
@@ -97,6 +96,8 @@ export default function BlogPostShow() {
<%_ if (answers["data-provider"] === "data-provider-hasura") { _%>
+<%_ } else if (answers["data-provider"] === "data-provider-appwrite") { _%>
+
<%_ } else { _%>
<%_ } _%>
diff --git a/refine-remix/plugins/_base/extend.js b/refine-remix/plugins/_base/extend.js
index 1ec88ecc9..b309951f9 100644
--- a/refine-remix/plugins/_base/extend.js
+++ b/refine-remix/plugins/_base/extend.js
@@ -152,6 +152,8 @@ module.exports = {
base.blogPostCategoryIdFormField = `"categoryId"`;
} else if (dataProvider === "data-provider-supabase") {
base.blogPostCategoryIdFormField = `"categoryId"`;
+ } else if (dataProvider === "data-provider-appwrite") {
+ base.blogPostCategoryIdFormField = `"category"`;
} else {
if (uiFramework === "mui" || isHeadless) {
base.blogPostCategoryIdFormField = `"category.id"`;
@@ -161,7 +163,7 @@ module.exports = {
}
// ## blogPostCategoryTableField
- if (base.isGraphQL) {
+ if (base.isGraphQL || dataProvider === "data-provider-appwrite") {
if (isHeadless) {
base.blogPostCategoryTableField = `"category.title"`;
}
diff --git a/refine-remix/plugins/antd-example/app/routes/_layout.blog-posts._index.tsx b/refine-remix/plugins/antd-example/app/routes/_layout.blog-posts._index.tsx
index 6d6592054..1446a4fc4 100644
--- a/refine-remix/plugins/antd-example/app/routes/_layout.blog-posts._index.tsx
+++ b/refine-remix/plugins/antd-example/app/routes/_layout.blog-posts._index.tsx
@@ -42,7 +42,7 @@ export default function BlogPostList() {
<%_ } _%>
});
-<%_ if (!isGraphQL) { _%>
+<%_ if (!isGraphQL && answers["data-provider"] !== "data-provider-appwrite") { _%>
const { data: categoryData, isLoading: categoryIsLoading } = useMany({
resource: "categories",
ids: tableProps?.dataSource?.map((item) => item?.<%- blogPostCategoryFieldName %>?.id).filter(Boolean) ?? [],
@@ -68,7 +68,7 @@ export default function BlogPostList() {
}
title={"Category"}
- <%_ if (!isGraphQL) { _%>
+ <%_ if (!isGraphQL && answers["data-provider"] !== "data-provider-appwrite") { _%>
render={(value) =>
categoryIsLoading ? (
<>Loading...>
@@ -84,6 +84,8 @@ export default function BlogPostList() {
dataIndex={["created_at"]}
+<%_ } else if (answers["data-provider"] === "data-provider-appwrite") { _%>
+ dataIndex={["$createdAt"]}
<%_ } else { _%>
dataIndex={["createdAt"]}
<%_ } _%>
diff --git a/refine-remix/plugins/antd-example/app/routes/_layout.blog-posts.edit.$id.tsx b/refine-remix/plugins/antd-example/app/routes/_layout.blog-posts.edit.$id.tsx
index 684656a4f..a2db323d1 100644
--- a/refine-remix/plugins/antd-example/app/routes/_layout.blog-posts.edit.$id.tsx
+++ b/refine-remix/plugins/antd-example/app/routes/_layout.blog-posts.edit.$id.tsx
@@ -29,6 +29,18 @@ export default function BlogPostEdit() {
meta: {
select: '*, categories(id,title)',
},
+<%_ } _%>
+<%_ if (answers["data-provider"] === "data-provider-appwrite") { _%>
+ queryOptions: {
+ select: ({ data }) => {
+ return {
+ data: {
+ ...data,
+ category: data.category.$id,
+ },
+ };
+ },
+ },
<%_ } _%>
});
@@ -36,7 +48,11 @@ export default function BlogPostEdit() {
const { selectProps: categorySelectProps } = useSelect({
resource: "categories",
+<%_ if (answers["data-provider"] === "data-provider-appwrite") { _%>
+ defaultValue: blogPostsData?.<%- blogPostCategoryFieldName %>,
+<%_ } else { _%>
defaultValue: blogPostsData?.<%- blogPostCategoryFieldName %>?.id,
+<%_ } _%>
<%_ if (answers["data-provider"] === "data-provider-hasura") { _%>
meta: {
fields: BLOG_POSTS_CATEGORIES_SELECT_QUERY,
diff --git a/refine-remix/plugins/antd-example/app/routes/_layout.blog-posts.show.$id.tsx b/refine-remix/plugins/antd-example/app/routes/_layout.blog-posts.show.$id.tsx
index c51020ae4..06bffa7d0 100644
--- a/refine-remix/plugins/antd-example/app/routes/_layout.blog-posts.show.$id.tsx
+++ b/refine-remix/plugins/antd-example/app/routes/_layout.blog-posts.show.$id.tsx
@@ -44,7 +44,7 @@ export default function BlogPostShow() {
const record = data?.data;
-<%_ if (!isGraphQL) { _%>
+<%_ if (!isGraphQL && answers["data-provider"] !== "data-provider-appwrite") { _%>
const { data: categoryData, isLoading: categoryIsLoading } = useOne({
resource: "categories",
id: record?.<%- blogPostCategoryFieldName %>?.id || "",
@@ -63,7 +63,7 @@ export default function BlogPostShow() {
{"Content"}
{"Category"}
-<%_ if (isGraphQL) { _%>
+<%_ if (isGraphQL || answers["data-provider"] === "data-provider-appwrite") { _%>
?.title} />
<%_ } else { _%>
{"Status"}
{"CreatedAt"}
-
+<%_ if (answers["data-provider"] === "data-provider-appwrite") { _%>
+
+<%_ } else if (answers["data-provider"] === "data-provider-hasura") { _%>
+
+<%_ } else { _%>
+
+<%_ } _%>
);
};
diff --git a/refine-remix/plugins/data-provider-appwrite/app/utility/appwriteClient.ts b/refine-remix/plugins/data-provider-appwrite/app/utility/appwriteClient.ts
index 4222ad970..9fb270c5a 100644
--- a/refine-remix/plugins/data-provider-appwrite/app/utility/appwriteClient.ts
+++ b/refine-remix/plugins/data-provider-appwrite/app/utility/appwriteClient.ts
@@ -1,7 +1,7 @@
import { Account, Appwrite, Storage } from "@refinedev/appwrite";
-const APPWRITE_URL = "https://refine.appwrite.org/v1";
-const APPWRITE_PROJECT = "61c4368b4e349";
+const APPWRITE_URL = "https://cloud.appwrite.io/v1";
+const APPWRITE_PROJECT = "6697687d002cbd31ba6b";
const TOKEN_KEY = "appwrite-token";
const appwriteClient = new Appwrite();
diff --git a/refine-remix/plugins/data-provider-appwrite/extend.js b/refine-remix/plugins/data-provider-appwrite/extend.js
index d0848d00c..ad251e8d7 100644
--- a/refine-remix/plugins/data-provider-appwrite/extend.js
+++ b/refine-remix/plugins/data-provider-appwrite/extend.js
@@ -9,10 +9,10 @@ const base = {
],
refineProps: [
`dataProvider={dataProvider(appwriteClient, {
- databaseId: "database",
+ databaseId: "default",
})}`,
`liveProvider={liveProvider(appwriteClient, {
- databaseId: "database",
+ databaseId: "default",
})}`,
`authProvider={authProvider}`,
],
diff --git a/refine-remix/plugins/headless-example/app/routes/_layout.blog-posts._index.tsx b/refine-remix/plugins/headless-example/app/routes/_layout.blog-posts._index.tsx
index fb549b35b..7748f75f1 100644
--- a/refine-remix/plugins/headless-example/app/routes/_layout.blog-posts._index.tsx
+++ b/refine-remix/plugins/headless-example/app/routes/_layout.blog-posts._index.tsx
@@ -36,7 +36,7 @@ export default function BlogPostList() {
id: "category",
header: "Category",
accessorKey: <%- blogPostCategoryTableField %>,
- <%_ if (!isGraphQL) { _%>
+ <%_ if (!isGraphQL && answers["data-provider"] !== "data-provider-appwrite") { _%>
cell: function render({ getValue, table }) {
const meta = table.options.meta as {
categoryData: GetManyResponse;
@@ -62,9 +62,11 @@ export default function BlogPostList() {
{
id: "createdAt",
<%_ if (answers["data-provider"] === "data-provider-hasura") { _%>
- accessorKey: "created_at",
+ accessorKey: "created_at",
+<%_ } else if (answers["data-provider"] === "data-provider-appwrite") { _%>
+ accessorKey: "$createdAt",
<%_ } else { _%>
- accessorKey: "createdAt",
+ accessorKey: "createdAt",
<%_ } _%>
header: "Created At",
cell: function render({ getValue }) {
@@ -158,7 +160,7 @@ export default function BlogPostList() {
<%_ } _%>
});
-<%_ if (!isGraphQL) { _%>
+<%_ if (!isGraphQL && answers["data-provider"] !== "data-provider-appwrite") { _%>
const { data: categoryData } = useMany({
resource: "categories",
ids: tableData?.data?.map((item) => item?.<%- blogPostCategoryFieldName %>?.id).filter(Boolean) ?? [],
diff --git a/refine-remix/plugins/headless-example/app/routes/_layout.blog-posts.create.tsx b/refine-remix/plugins/headless-example/app/routes/_layout.blog-posts.create.tsx
index 74531fc3e..48bb253b6 100644
--- a/refine-remix/plugins/headless-example/app/routes/_layout.blog-posts.create.tsx
+++ b/refine-remix/plugins/headless-example/app/routes/_layout.blog-posts.create.tsx
@@ -110,7 +110,11 @@ export default function BlogPostCreate() {
))}
+<%_ if (answers["data-provider"] === "data-provider-appwrite") { _%>
+ {(errors as any)?.<%- blogPostCategoryFieldName %>?.message as string}
+<%_ } else { _%>
{(errors as any)?.<%- blogPostCategoryFieldName %>?.id?.message as string}
+<%_ } _%>
{"Category"}
-<%_ if (isGraphQL) { _%>
+<%_ if (isGraphQL || answers["data-provider"] === "data-provider-appwrite") { _%>
{record?.<%- blogPostCategoryFieldName %>?.title}
<%_ } else { _%>
@@ -106,6 +106,10 @@ export default function BlogPostShow() {
{new Date(record?.created_at).toLocaleString(undefined, {
timeZone: "UTC",
})}
+<%_ } else if (answers["data-provider"] === "data-provider-appwrite") { _%>
+ {new Date(record?.$createdAt).toLocaleString(undefined, {
+ timeZone: "UTC",
+ })}
<%_ } else { _%>
{new Date(record?.createdAt).toLocaleString(undefined, {
timeZone: "UTC",
diff --git a/refine-remix/plugins/mui-example/app/routes/_layout.blog-posts._index.tsx b/refine-remix/plugins/mui-example/app/routes/_layout.blog-posts._index.tsx
index ecfff4e48..c31389866 100644
--- a/refine-remix/plugins/mui-example/app/routes/_layout.blog-posts._index.tsx
+++ b/refine-remix/plugins/mui-example/app/routes/_layout.blog-posts._index.tsx
@@ -42,7 +42,7 @@ export default function BlogPostList() {
<%_ } _%>
});
-<%_ if (!isGraphQL) { _%>
+<%_ if (!isGraphQL && answers["data-provider"] !== "data-provider-appwrite") { _%>
const { data: categoryData, isLoading: categoryIsLoading } = useMany({
resource: "categories",
ids: dataGridProps?.rows?.map((item: any) => item?.<%- blogPostCategoryFieldName %>?.id).filter(Boolean) ?? [],
@@ -69,7 +69,7 @@ export default function BlogPostList() {
{
field: "content",
flex: 1,
- headerName: "content",
+ headerName: "Content",
minWidth: 250,
renderCell: function render({ value }) {
if (!value) return '-'
@@ -83,7 +83,7 @@ export default function BlogPostList() {
flex: 1,
headerName: "Category",
minWidth: 300,
- <%_ if (isGraphQL) { _%>
+ <%_ if (isGraphQL || answers["data-provider"] === "data-provider-appwrite") { _%>
valueGetter: ({ row }) => {
const value = row?.<%- blogPostCategoryFieldName %>?.title
return value
@@ -111,6 +111,8 @@ export default function BlogPostList() {
{
<%_ if (answers["data-provider"] === "data-provider-hasura") { _%>
field: "created_at",
+<%_ } else if (answers["data-provider"] === "data-provider-appwrite") { _%>
+ field: "$createdAt",
<%_ } else { _%>
field: "createdAt",
<%_ } _%>
@@ -139,7 +141,7 @@ export default function BlogPostList() {
minWidth: 80,
},
],
- <%_ if (isGraphQL) { _%>
+ <%_ if (isGraphQL || answers["data-provider"] === "data-provider-appwrite") { _%>
[],
<%_ } else { _%>
[categoryData],
diff --git a/refine-remix/plugins/mui-example/app/routes/_layout.blog-posts.create.tsx b/refine-remix/plugins/mui-example/app/routes/_layout.blog-posts.create.tsx
index 9559dd6fc..df3067ef0 100644
--- a/refine-remix/plugins/mui-example/app/routes/_layout.blog-posts.create.tsx
+++ b/refine-remix/plugins/mui-example/app/routes/_layout.blog-posts.create.tsx
@@ -115,10 +115,17 @@ export default function BlogPostCreate() {
label={"Category"}
margin="normal"
variant="outlined"
+<%_ if (answers["data-provider"] === "data-provider-appwrite") { _%>
+ error={!!(errors as any)?.<%- blogPostCategoryFieldName %>}
+ helperText={
+ (errors as any)?.<%- blogPostCategoryFieldName %>?.message
+ }
+<%_ } else { _%>
error={!!(errors as any)?.<%- blogPostCategoryFieldName %>?.id}
helperText={
(errors as any)?.<%- blogPostCategoryFieldName %>?.id?.message
}
+<%_ } _%>
required
/>
)}
diff --git a/refine-remix/plugins/mui-example/app/routes/_layout.blog-posts.edit.$id.tsx b/refine-remix/plugins/mui-example/app/routes/_layout.blog-posts.edit.$id.tsx
index d088ab32e..0f9675dff 100644
--- a/refine-remix/plugins/mui-example/app/routes/_layout.blog-posts.edit.$id.tsx
+++ b/refine-remix/plugins/mui-example/app/routes/_layout.blog-posts.edit.$id.tsx
@@ -47,6 +47,20 @@ export default function BlogPostEdit() {
select: '*, categories(id,title)',
},
},
+<%_ } _%>
+<%_ if (answers["data-provider"] === "data-provider-appwrite") { _%>
+ refineCoreProps: {
+ queryOptions: {
+ select: ({ data }) => {
+ return {
+ data: {
+ ...data,
+ category: data.category.$id,
+ },
+ };
+ },
+ },
+ },
<%_ } _%>
});
@@ -54,7 +68,11 @@ export default function BlogPostEdit() {
const { autocompleteProps: categoryAutocompleteProps } = useAutocomplete({
resource: "categories",
+<%_ if (answers["data-provider"] === "data-provider-appwrite") { _%>
+ defaultValue: blogPostsData?.<%- blogPostCategoryFieldName %>,
+<%_ } else { _%>
defaultValue: blogPostsData?.<%- blogPostCategoryFieldName %>?.id,
+<%_ } _%>
<%_ if (answers["data-provider"] === "data-provider-hasura") { _%>
meta: {
fields: BLOG_POSTS_CATEGORIES_SELECT_QUERY,
@@ -135,10 +153,17 @@ export default function BlogPostEdit() {
label={"Category"}
margin="normal"
variant="outlined"
+<%_ if (answers["data-provider"] === "data-provider-appwrite") { _%>
+ error={!!(errors as any)?.<%- blogPostCategoryFieldName %>}
+ helperText={
+ (errors as any)?.<%- blogPostCategoryFieldName %>?.message
+ }
+<%_ } else { _%>
error={!!(errors as any)?.<%- blogPostCategoryFieldName %>?.id}
helperText={
(errors as any)?.<%- blogPostCategoryFieldName %>?.id?.message
}
+<%_ } _%>
required
/>
)}
diff --git a/refine-remix/plugins/mui-example/app/routes/_layout.blog-posts.show.$id.tsx b/refine-remix/plugins/mui-example/app/routes/_layout.blog-posts.show.$id.tsx
index 196c6de00..d16e9de89 100644
--- a/refine-remix/plugins/mui-example/app/routes/_layout.blog-posts.show.$id.tsx
+++ b/refine-remix/plugins/mui-example/app/routes/_layout.blog-posts.show.$id.tsx
@@ -43,7 +43,7 @@ export default function BlogPostShow() {
const record = data?.data;
-<%_ if (!isGraphQL) { _%>
+<%_ if (!isGraphQL && answers["data-provider"] !== "data-provider-appwrite") { _%>
const { data: categoryData, isLoading: categoryIsLoading } = useOne({
resource: "categories",
id: record?.<%- blogPostCategoryFieldName %>?.id || "",
@@ -71,14 +71,17 @@ export default function BlogPostShow() {
-<%_ if (isGraphQL) { _%>
-
{record?.<%- blogPostCategoryFieldName %>?.title}
+
+ {"Category"}
+
+<%_ if (isGraphQL || answers["data-provider"] === "data-provider-appwrite") { _%>
+
{record?.<%- blogPostCategoryFieldName %>?.title}
<%_ } else { _%>
- {categoryIsLoading ? (
- <>Loading...>
- ) : (
- <>{categoryData?.data?.title}>
- )}
+ {categoryIsLoading ? (
+ <>Loading...>
+ ) : (
+ <>{categoryData?.data?.title}>
+ )}
<%_ } _%>
@@ -88,6 +91,8 @@ export default function BlogPostShow() {
<%_ if (answers["data-provider"] === "data-provider-hasura") { _%>
+<%_ } else if (answers["data-provider"] === "data-provider-appwrite") { _%>
+
<%_ } else { _%>
<%_ } _%>
diff --git a/refine-vite/plugins/_base/extend.js b/refine-vite/plugins/_base/extend.js
index 801cd7bfa..c3caed5a4 100644
--- a/refine-vite/plugins/_base/extend.js
+++ b/refine-vite/plugins/_base/extend.js
@@ -198,6 +198,8 @@ module.exports = {
base.blogPostCategoryIdFormField = `"categoryId"`;
} else if (dataProvider === "data-provider-supabase") {
base.blogPostCategoryIdFormField = `"categoryId"`;
+ } else if (dataProvider === "data-provider-appwrite") {
+ base.blogPostCategoryIdFormField = `"category"`;
} else {
if (uiFramework === "mui" || isHeadless) {
base.blogPostCategoryIdFormField = `"category.id"`;
@@ -207,7 +209,7 @@ module.exports = {
}
// ## blogPostCategoryTableField
- if (base.isGraphQL) {
+ if (base.isGraphQL || dataProvider === "data-provider-appwrite") {
if (isHeadless) {
base.blogPostCategoryTableField = `"category.title"`;
}
diff --git a/refine-vite/plugins/antd-example/src/pages/blog-posts/edit.tsx b/refine-vite/plugins/antd-example/src/pages/blog-posts/edit.tsx
index 08b9fa7ee..01cd4e00a 100644
--- a/refine-vite/plugins/antd-example/src/pages/blog-posts/edit.tsx
+++ b/refine-vite/plugins/antd-example/src/pages/blog-posts/edit.tsx
@@ -30,6 +30,18 @@ export const BlogPostEdit = () => {
meta: {
select: '*, categories(id,title)',
},
+<%_ } _%>
+<%_ if (answers["data-provider"] === "data-provider-appwrite") { _%>
+ queryOptions: {
+ select: ({ data }) => {
+ return {
+ data: {
+ ...data,
+ category: data.category.$id,
+ },
+ };
+ },
+ },
<%_ } _%>
});
@@ -37,10 +49,17 @@ export const BlogPostEdit = () => {
const { selectProps: categorySelectProps } = useSelect({
resource: "categories",
+<%_ if (answers["data-provider"] === "data-provider-appwrite") { _%>
defaultValue: blogPostsData?.<%- blogPostCategoryFieldName %>?.id,
queryOptions: {
enabled: !!blogPostsData?.<%- blogPostCategoryFieldName %>?.id,
},
+<%_ } else { _%>
+ defaultValue: blogPostsData?.<%- blogPostCategoryFieldName %>,
+ queryOptions: {
+ enabled: !!blogPostsData?.<%- blogPostCategoryFieldName %>,
+ },
+<%_ } _%>
<%_ if (answers["data-provider"] === "data-provider-hasura") { _%>
meta: {
fields: BLOG_POSTS_CATEGORIES_SELECT_QUERY,
@@ -82,7 +101,11 @@ export const BlogPostEdit = () => {
}
- initialValue={formProps?.initialValues?.<%- blogPostCategoryFieldName %>?.id}
+<%_ if (answers["data-provider"] === "data-provider-appwrite") { _%>
+ initialValue={formProps?.initialValues?.<%- blogPostCategoryFieldName %>}
+<%_ } else { _%>
+ initialValue={formProps?.initialValues?.<%- blogPostCategoryFieldName %>?.id}
+<%_ } _%>
rules={[
{
required: true,
diff --git a/refine-vite/plugins/antd-example/src/pages/blog-posts/list.tsx b/refine-vite/plugins/antd-example/src/pages/blog-posts/list.tsx
index 067d92889..f4672b7f1 100644
--- a/refine-vite/plugins/antd-example/src/pages/blog-posts/list.tsx
+++ b/refine-vite/plugins/antd-example/src/pages/blog-posts/list.tsx
@@ -42,7 +42,7 @@ export const BlogPostList = () => {
<%_ } _%>
});
-<%_ if (!isGraphQL) { _%>
+<%_ if (!isGraphQL && answers["data-provider"] !== "data-provider-appwrite") { _%>
const { data: categoryData, isLoading: categoryIsLoading } = useMany({
resource: "categories",
ids: tableProps?.dataSource?.map((item) => item?.<%- blogPostCategoryFieldName %>?.id).filter(Boolean) ?? [],
@@ -69,7 +69,7 @@ export const BlogPostList = () => {
}
title={"Category"}
- <%_ if (!isGraphQL) { _%>
+ <%_ if (!isGraphQL && answers["data-provider"] !== "data-provider-appwrite") { _%>
render={(value) =>
categoryIsLoading ? (
<>Loading...>
@@ -85,6 +85,8 @@ export const BlogPostList = () => {
dataIndex={["created_at"]}
+<%_ } else if (answers["data-provider"] === "data-provider-appwrite") { _%>
+ dataIndex={["$createdAt"]}
<%_ } else { _%>
dataIndex={["createdAt"]}
<%_ } _%>
diff --git a/refine-vite/plugins/antd-example/src/pages/blog-posts/show.tsx b/refine-vite/plugins/antd-example/src/pages/blog-posts/show.tsx
index 9b7e718ef..ae706c8a6 100644
--- a/refine-vite/plugins/antd-example/src/pages/blog-posts/show.tsx
+++ b/refine-vite/plugins/antd-example/src/pages/blog-posts/show.tsx
@@ -44,7 +44,7 @@ export const BlogPostShow = () => {
const record = data?.data;
-<%_ if (!isGraphQL) { _%>
+<%_ if (!isGraphQL && answers["data-provider"] !== "data-provider-appwrite") { _%>
const { data: categoryData, isLoading: categoryIsLoading } = useOne({
resource: "categories",
id: record?.<%- blogPostCategoryFieldName %>?.id || "",
@@ -64,7 +64,7 @@ export const BlogPostShow = () => {
{"Content"}
{"Category"}
-<%_ if (isGraphQL) { _%>
+<%_ if (isGraphQL || answers["data-provider"] === "data-provider-appwrite") { _%>
?.title} />
<%_ } else { _%>
{
{"Status"}
{"CreatedAt"}
+<%_ if (answers["data-provider"] === "data-provider-appwrite") { _%>
+
+<%_ } else if (answers["data-provider"] === "data-provider-hasura") { _%>
+
+<%_ } else { _%>
+<%_ } _%>
);
};
diff --git a/refine-vite/plugins/data-provider-appwrite/extend.js b/refine-vite/plugins/data-provider-appwrite/extend.js
index 69ef979d7..148b655f8 100644
--- a/refine-vite/plugins/data-provider-appwrite/extend.js
+++ b/refine-vite/plugins/data-provider-appwrite/extend.js
@@ -7,10 +7,10 @@ const base = {
relativeImport: [`import { authProvider } from "./authProvider";`],
refineProps: [
`dataProvider={dataProvider(appwriteClient, {
- databaseId: "database",
+ databaseId: "default",
})}`,
`liveProvider={liveProvider(appwriteClient, {
- databaseId: "database",
+ databaseId: "default",
})}`,
`authProvider={authProvider}`,
],
diff --git a/refine-vite/plugins/data-provider-appwrite/src/utility/appwriteClient.ts b/refine-vite/plugins/data-provider-appwrite/src/utility/appwriteClient.ts
index 6c36280cb..3dd3777e7 100644
--- a/refine-vite/plugins/data-provider-appwrite/src/utility/appwriteClient.ts
+++ b/refine-vite/plugins/data-provider-appwrite/src/utility/appwriteClient.ts
@@ -1,7 +1,7 @@
import { Account, Appwrite, Storage } from "@refinedev/appwrite";
-const APPWRITE_URL = "https://refine.appwrite.org/v1";
-const APPWRITE_PROJECT = "61c4368b4e349";
+const APPWRITE_URL = "https://cloud.appwrite.io/v1";
+const APPWRITE_PROJECT = "6697687d002cbd31ba6b";
const appwriteClient = new Appwrite();
diff --git a/refine-vite/plugins/headless-example/src/pages/blog-posts/create.tsx b/refine-vite/plugins/headless-example/src/pages/blog-posts/create.tsx
index 79a2c1815..528d1c1db 100644
--- a/refine-vite/plugins/headless-example/src/pages/blog-posts/create.tsx
+++ b/refine-vite/plugins/headless-example/src/pages/blog-posts/create.tsx
@@ -110,7 +110,11 @@ export const BlogPostCreate = () => {
))}
+<%_ if (answers["data-provider"] === "data-provider-appwrite") { _%>
+ {(errors as any)?.<%- blogPostCategoryFieldName %>?.message as string}
+<%_ } else { _%>
{(errors as any)?.<%- blogPostCategoryFieldName %>?.id?.message as string}
+<%_ } _%>
{"Category"}
-<%_ if (isGraphQL) { _%>
+<%_ if (isGraphQL || answers["data-provider"] === "data-provider-appwrite") { _%>
{record?.<%- blogPostCategoryFieldName %>?.title}
<%_ } else { _%>
@@ -106,6 +106,10 @@ export const BlogPostShow = () => {
{new Date(record?.created_at).toLocaleString(undefined, {
timeZone: "UTC",
})}
+<%_ } else if (answers["data-provider"] === "data-provider-appwrite") { _%>
+ {new Date(record?.$createdAt).toLocaleString(undefined, {
+ timeZone: "UTC",
+ })}
<%_ } else { _%>
{new Date(record?.createdAt).toLocaleString(undefined, {
timeZone: "UTC",
diff --git a/refine-vite/plugins/mui-example/src/pages/blog-posts/create.tsx b/refine-vite/plugins/mui-example/src/pages/blog-posts/create.tsx
index f75ca27d0..298be968b 100644
--- a/refine-vite/plugins/mui-example/src/pages/blog-posts/create.tsx
+++ b/refine-vite/plugins/mui-example/src/pages/blog-posts/create.tsx
@@ -114,10 +114,17 @@ export const BlogPostCreate = () => {
label={"Category"}
margin="normal"
variant="outlined"
+<%_ if (answers["data-provider"] === "data-provider-appwrite") { _%>
+ error={!!(errors as any)?.<%- blogPostCategoryFieldName %>}
+ helperText={
+ (errors as any)?.<%- blogPostCategoryFieldName %>?.message
+ }
+<%_ } else { _%>
error={!!(errors as any)?.<%- blogPostCategoryFieldName %>?.id}
helperText={
(errors as any)?.<%- blogPostCategoryFieldName %>?.id?.message
}
+<%_ } _%>
required
/>
)}
diff --git a/refine-vite/plugins/mui-example/src/pages/blog-posts/edit.tsx b/refine-vite/plugins/mui-example/src/pages/blog-posts/edit.tsx
index 68d35152c..60f23f6f4 100644
--- a/refine-vite/plugins/mui-example/src/pages/blog-posts/edit.tsx
+++ b/refine-vite/plugins/mui-example/src/pages/blog-posts/edit.tsx
@@ -46,6 +46,20 @@ export const BlogPostEdit = () => {
select: '*, categories(id,title)',
},
},
+<%_ } _%>
+<%_ if (answers["data-provider"] === "data-provider-appwrite") { _%>
+ refineCoreProps: {
+ queryOptions: {
+ select: ({ data }) => {
+ return {
+ data: {
+ ...data,
+ category: data.category.$id,
+ },
+ };
+ },
+ },
+ },
<%_ } _%>
});
@@ -53,7 +67,11 @@ export const BlogPostEdit = () => {
const { autocompleteProps: categoryAutocompleteProps } = useAutocomplete({
resource: "categories",
+<%_ if (answers["data-provider"] === "data-provider-appwrite") { _%>
+ defaultValue: blogPostsData?.<%- blogPostCategoryFieldName %>,
+<%_ } else { _%>
defaultValue: blogPostsData?.<%- blogPostCategoryFieldName %>?.id,
+<%_ } _%>
<%_ if (answers["data-provider"] === "data-provider-hasura") { _%>
meta: {
fields: BLOG_POSTS_CATEGORIES_SELECT_QUERY,
@@ -134,10 +152,17 @@ export const BlogPostEdit = () => {
label={"Category"}
margin="normal"
variant="outlined"
+<%_ if (answers["data-provider"] === "data-provider-appwrite") { _%>
+ error={!!(errors as any)?.<%- blogPostCategoryFieldName %>}
+ helperText={
+ (errors as any)?.<%- blogPostCategoryFieldName %>?.message
+ }
+<%_ } else { _%>
error={!!(errors as any)?.<%- blogPostCategoryFieldName %>?.id}
helperText={
(errors as any)?.<%- blogPostCategoryFieldName %>?.id?.message
}
+<%_ } _%>
required
/>
)}
diff --git a/refine-vite/plugins/mui-example/src/pages/blog-posts/list.tsx b/refine-vite/plugins/mui-example/src/pages/blog-posts/list.tsx
index 226a5e2d2..eabc3a657 100644
--- a/refine-vite/plugins/mui-example/src/pages/blog-posts/list.tsx
+++ b/refine-vite/plugins/mui-example/src/pages/blog-posts/list.tsx
@@ -43,7 +43,7 @@ export const BlogPostList = () => {
<%_ } _%>
});
-<%_ if (!isGraphQL) { _%>
+<%_ if (!isGraphQL && answers["data-provider"] !== "data-provider-appwrite") { _%>
const { data: categoryData, isLoading: categoryIsLoading } = useMany({
resource: "categories",
ids: dataGridProps?.rows?.map((item: any) => item?.<%- blogPostCategoryFieldName %>?.id).filter(Boolean) ?? [],
@@ -70,7 +70,7 @@ export const BlogPostList = () => {
{
field: "content",
flex: 1,
- headerName: "content",
+ headerName: "Content",
minWidth: 250,
renderCell: function render({ value }) {
if (!value) return '-'
@@ -84,7 +84,7 @@ export const BlogPostList = () => {
flex: 1,
headerName: "Category",
minWidth: 300,
- <%_ if (isGraphQL) { _%>
+ <%_ if (isGraphQL || answers["data-provider"] === "data-provider-appwrite") { _%>
valueGetter: ({ row }) => {
const value = row?.<%- blogPostCategoryFieldName %>?.title
return value
@@ -111,7 +111,9 @@ export const BlogPostList = () => {
},
{
<%_ if (answers["data-provider"] === "data-provider-hasura") { _%>
- field: "created_at",
+ field: "created_at",
+<%_ } else if (answers["data-provider"] === "data-provider-appwrite") { _%>
+ field: "$createdAt",
<%_ } else { _%>
field: "createdAt",
<%_ } _%>
@@ -140,7 +142,7 @@ export const BlogPostList = () => {
minWidth: 80,
},
],
- <%_ if (isGraphQL) { _%>
+ <%_ if (isGraphQL || answers["data-provider"] === "data-provider-appwrite") { _%>
[],
<%_ } else { _%>
[categoryData],
diff --git a/refine-vite/plugins/mui-example/src/pages/blog-posts/show.tsx b/refine-vite/plugins/mui-example/src/pages/blog-posts/show.tsx
index 0df95b619..db03637d3 100644
--- a/refine-vite/plugins/mui-example/src/pages/blog-posts/show.tsx
+++ b/refine-vite/plugins/mui-example/src/pages/blog-posts/show.tsx
@@ -42,7 +42,7 @@ export const BlogPostShow = () => {
const record = data?.data;
-<%_ if (!isGraphQL) { _%>
+<%_ if (!isGraphQL && answers["data-provider"] !== "data-provider-appwrite") { _%>
const { data: categoryData, isLoading: categoryIsLoading } = useOne({
resource: "categories",
id: record?.<%- blogPostCategoryFieldName %>?.id || "",
@@ -75,7 +75,7 @@ export const BlogPostShow = () => {
{"Category"}
-<%_ if (isGraphQL) { _%>
+<%_ if (isGraphQL || answers["data-provider"] === "data-provider-appwrite") { _%>
{record?.<%- blogPostCategoryFieldName %>?.title}
<%_ } else { _%>
{categoryIsLoading ? (
@@ -93,6 +93,8 @@ export const BlogPostShow = () => {
<%_ if (answers["data-provider"] === "data-provider-hasura") { _%>
+<%_ } else if (answers["data-provider"] === "data-provider-appwrite") { _%>
+
<%_ } else { _%>
<%_ } _%>