mirror of
https://github.com/R0m1k3/Socialflow.git
synced 2026-10-11 17:26:45 +02:00
Add user management features for administrators to control accounts
Implement CRUD operations for users, including listing, creating, editing, and deleting users, along with updates to authentication and UI components. Replit-Commit-Author: Agent Replit-Commit-Session-Id: ae4037a0-2a6f-4530-9bac-79b543286bda Replit-Commit-Checkpoint-Type: intermediate_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/397bca8c-984f-43ff-841a-10897aeb8140/ae4037a0-2a6f-4530-9bac-79b543286bda/HPCBgsr
This commit is contained in:
1 parent
ebc581e015
commit
f6d82f67ba
6 files changed
+507
-102
No files matched your search
@@ -31,7 +31,10 @@ export interface IStorage {
|
||||
// Users
|
||||
getUser(id: string): Promise<User | undefined>;
|
||||
getUserByUsername(username: string): Promise<User | undefined>;
|
||||
getAllUsers(): Promise<User[]>;
|
||||
createUser(user: InsertUser): Promise<User>;
|
||||
updateUser(id: string, user: Partial<InsertUser>): Promise<User>;
|
||||
deleteUser(id: string): Promise<void>;
|
||||
|
||||
// Social Pages
|
||||
getSocialPages(userId: string): Promise<SocialPage[]>;
|
||||
@@ -88,11 +91,24 @@ export class DatabaseStorage implements IStorage {
|
||||
return user || undefined;
|
||||
}
|
||||
|
||||
async getAllUsers(): Promise<User[]> {
|
||||
return await db.select().from(users);
|
||||
}
|
||||
|
||||
async createUser(insertUser: InsertUser): Promise<User> {
|
||||
const [user] = await db.insert(users).values(insertUser).returning();
|
||||
return user;
|
||||
}
|
||||
|
||||
async updateUser(id: string, updateData: Partial<InsertUser>): Promise<User> {
|
||||
const [updated] = await db.update(users).set(updateData).where(eq(users.id, id)).returning();
|
||||
return updated;
|
||||
}
|
||||
|
||||
async deleteUser(id: string): Promise<void> {
|
||||
await db.delete(users).where(eq(users.id, id));
|
||||
}
|
||||
|
||||
// Social Pages
|
||||
async getSocialPages(userId: string): Promise<SocialPage[]> {
|
||||
return await db.select().from(socialPages).where(eq(socialPages.userId, userId));
|
||||
|
||||
Reference in new issue
Block a user