-
Notifications
You must be signed in to change notification settings - Fork 4.4k
🚀 Feature: Delete all users with one command #5171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@anasfik, thanks for creating this issue! 🙏🏼 For now, I recommend creating a script or a function that uses the server SDK to perform this action. Related: |
Hey @stnguyen90 , |
@singhbhaskar we're hesitant to introduce this right now so it's probably not a good thing for you to work on right now. That said, if you'd like to contribute, you could create an Appwrite Function that wipes users and submit a PR, in our examples repo. |
@stnguyen90 I did not have a appwrite function. But, I already had a vercel serveless function that does this users cleanup job. Appwrite function logic is exactly similar to this:- import { NextResponse } from "next/server";
import { Client, Users } from "node-appwrite";
export async function POST(req: Request, res: Response) {
const client = new Client()
.setEndpoint(process.env.APPWRITE_ENDPOINT!)
.setProject(process.env.APPWRITE_PROJECT_ID!)
.setKey(process.env.APPWRITE_SERVER_KEY!);
const users = new Users(client);
try {
const userListObj = await users.list();
const userList = userListObj.users;
userList.forEach(async user => {
await users.delete(user.$id);
});
return NextResponse.json({ success: true });
} catch (e: any) {
console.error(e);
return NextResponse.json({ error: e.message });
}
} |
🔖 Feature description
the feature is about deleting all users and collecting documents simultaneously with a simple server SDK method or an appwrite cli command.
For example, for deleting users from cli:
for confirmation on such commands, a confirmation with (Y/n) style or re-inputting the password will be fair for not executing randomly and for security.
🎤 Pitch
Well, this might be personal, but this is why I downloaded the CLI to check if such commands exist.
while developing an app using appwrite, developers will definitely create test accounts, collections, documents while implementing a feature, especially a related feature such as:
and this task can be done repetitively for developing purposes, then after the feature is implemented, we find a lot of user accounts and documents, and running a command to delete them is better than doing it manually to move to another project.
👀 Have you spent some time to check if this issue has been raised before?
🏢 Have you read the Code of Conduct?
The text was updated successfully, but these errors were encountered: