updating schema field of type: string[] doesn't work.

I'm trying to extend organizations plugin. I'm trying to add projects field to of type "string[]". The problem is that Whenever I try to update it, it doesn't change. plugins schema:
schema: {
member: {
fields: {
projects: {
type: "string[]",
required: false,
fieldName: options?.schema?.member?.fields?.projects,
},
}
}
}
schema: {
member: {
fields: {
projects: {
type: "string[]",
required: false,
fieldName: options?.schema?.member?.fields?.projects,
},
}
}
}
Whenever I try to update it with the adapter. I setup for the plugin, the projects don't update. Note that the adapter works perfectly on other stuff. adapter.ts
export const getOrgAdapter = (
context: AuthContext,
options?: OrganizationOptions
) => {
const adapter = context.adapter;
return {
updateProjectAccess: async (
memberId: string,
data: {
projects: string[];
}
) => {
const { projects } = data;
const updated = await adapter.update({
model: "member",
where: [
{
field: "id",
value: memberId,
},
],
update: [{ field: "projects", value: projects }],
});
return {
projects,
};
},
}
}
export const getOrgAdapter = (
context: AuthContext,
options?: OrganizationOptions
) => {
const adapter = context.adapter;
return {
updateProjectAccess: async (
memberId: string,
data: {
projects: string[];
}
) => {
const { projects } = data;
const updated = await adapter.update({
model: "member",
where: [
{
field: "id",
value: memberId,
},
],
update: [{ field: "projects", value: projects }],
});
return {
projects,
};
},
}
}
I also tried
update: [{ field: "projects", value: JSON.stringify(projects) }],
update: [{ field: "projects", value: JSON.stringify(projects) }],
But in vain. Here is how it looks like in my prisma schema by default:
No description
9 Replies
Maqed
MaqedOP3d ago
@admin Could anyone please help me. I've been stuck with this issue for a while.
Ping
Ping2d ago
And you're on latest BA version?
Maqed
MaqedOP2d ago
Yeah
Ping
Ping2d ago
Can you submit this as a bug on the github issue? I think this is a bug in BA.
Maqed
MaqedOP2d ago
Sure!
Maqed
MaqedOP2d ago
GitHub
plugin schema of field type "string[]" not working properly · Issu...
Is this suited for github? Yes, this is suited for github To Reproduce Make a plugin with a schema of a field that has "string[]" type export const myPlugin(){ return { schema: member: { ...
Maqed
MaqedOP15h ago
Oops! nevermind the problem was from me I think
Ping
Ping10h ago
May I mark this as solved?
Maqed
MaqedOP10h ago
Yeah

Did you find this page helpful?