fix: allow null values in storage_limit column

This commit is contained in:
mngshm
2025-02-24 17:12:13 +05:30
parent 490a7221e7
commit 82ebcf66a5
3 changed files with 3 additions and 3 deletions

View File

@@ -1,2 +1,2 @@
ALTER TABLE families
ADD COLUMN storage_limit BIGINT;
ADD COLUMN storage_limit BIGINT NULL;

View File

@@ -232,7 +232,7 @@ func (c *Controller) ModifyMemberStorage(ctx context.Context, actorUserID int64,
}
}
modifyStorageErr := c.FamilyRepo.ModifyMemberStorage(ctx, actorUserID, member.ID, storageLimit)
modifyStorageErr := c.FamilyRepo.ModifyMemberStorage(ctx, member.ID, storageLimit)
if modifyStorageErr != nil {
return stacktrace.Propagate(modifyStorageErr, "Failed to modify members storage")
}

View File

@@ -197,7 +197,7 @@ func (repo *FamilyRepository) RemoveMember(ctx context.Context, adminID int64, m
}
// UpdateStorage is used to set Pre-existing Members Storage Limit.
func (repo *FamilyRepository) ModifyMemberStorage(ctx context.Context, adminID int64, id uuid.UUID, storageLimit *int64) error {
func (repo *FamilyRepository) ModifyMemberStorage(ctx context.Context, id uuid.UUID, storageLimit *int64) error {
_, err := repo.DB.Exec(`UPDATE families SET storage_limit=$1 where id=$2`, storageLimit, id)
if err != nil {
return stacktrace.Propagate(err, "Could not update Members Storage Limit")