feat: Implement comprehensive ban enforcement

This commit is contained in:
gpt-engineer-app[bot]
2025-10-30 01:47:51 +00:00
parent f95eaf9eb7
commit fe76c8c572
8 changed files with 452 additions and 0 deletions

View File

@@ -12,6 +12,17 @@ export async function submitCompanyCreation(
companyType: 'manufacturer' | 'designer' | 'operator' | 'property_owner',
userId: string
) {
// Check if user is banned
const { data: profile } = await supabase
.from('profiles')
.select('banned')
.eq('user_id', userId)
.single();
if (profile?.banned) {
throw new Error('Account suspended. Contact support for assistance.');
}
// Upload any pending local images first
let processedImages = data.images;
if (data.images?.uploaded && data.images.uploaded.length > 0) {
@@ -78,6 +89,17 @@ export async function submitCompanyUpdate(
data: CompanyFormData,
userId: string
) {
// Check if user is banned
const { data: profile } = await supabase
.from('profiles')
.select('banned')
.eq('user_id', userId)
.single();
if (profile?.banned) {
throw new Error('Account suspended. Contact support for assistance.');
}
// Fetch existing company data (all fields for original_data)
const { data: existingCompany, error: fetchError } = await supabase
.from('companies')