BasitAliii commited on
Commit
acdf009
·
verified ·
1 Parent(s): 4c2c3e7

Update storage.py

Browse files
Files changed (1) hide show
  1. storage.py +12 -0
storage.py CHANGED
@@ -58,6 +58,18 @@ class ProfileStore:
58
  self.save_all(profiles)
59
  return True, "Profile created."
60
 
 
 
 
 
 
 
 
 
 
 
 
 
61
 
62
  def validate_profile(profile: Profile) -> Tuple[bool, Optional[str]]:
63
  if not profile.username:
 
58
  self.save_all(profiles)
59
  return True, "Profile created."
60
 
61
+ # ✅ NEW DELETE METHOD
62
+ def delete(self, username: str) -> Tuple[bool, str]:
63
+ username = (username or "").strip()
64
+ profiles = self.load_all()
65
+ profiles_new = [p for p in profiles if p.username.lower() != username.lower()]
66
+
67
+ if len(profiles_new) == len(profiles):
68
+ return False, "Profile not found."
69
+
70
+ self.save_all(profiles_new)
71
+ return True, "Profile deleted."
72
+
73
 
74
  def validate_profile(profile: Profile) -> Tuple[bool, Optional[str]]:
75
  if not profile.username: