Profile Service

class ProfileService

profile.service.ts
import {
  effect,
  inject,
  Injectable,
  Signal,
  signal,
  untracked,
  WritableSignal,
} from '@angular/core';
import { Bucket } from '@jet/enums/bucket.enum';
import { Table } from '@jet/enums/table.enum';
import { Profile } from '@jet/interfaces/profile.interface';
import { FileObject, StorageError } from '@supabase/storage-js/';
import { SupabaseClient, User } from '@supabase/supabase-js';
import { AlertService } from '../alert/alert.service';
import { LoggerService } from '../logger/logger.service';
import { SupabaseService } from '../supabase/supabase.service';
import { UserService } from '../user/user.service';

@Injectable({
  providedIn: 'root',
})
export class ProfileService {
  private readonly _alertService = inject(AlertService);
  private readonly _loggerService = inject(LoggerService);
  private readonly _supabaseService = inject(SupabaseService);
  private readonly _userService = inject(UserService);

  private readonly _profile: WritableSignal<Profile | null>;
  private readonly _supabaseClient: SupabaseClient;

  public constructor() {
    // Buy to unlock
  }

  public get profile(): Signal<Profile | null> {
    // Buy to unlock
  }

  public getAvatarPublicUrl(path: string): string {
    // Buy to unlock
  }

  public deleteAvatar(
    publicUrl: string,
  ): Promise<
    { data: FileObject[]; error: null } | { data: null; error: StorageError }
  > {
    // Buy to unlock
  }

  public async selectProfile(): Promise<void> {
    // Buy to unlock
  }

  public updateProfile(partialProfile: Partial<Profile>) {
    // Buy to unlock
  }

  public uploadAvatar(
    file: File,
  ): Promise<
    | { data: { id: string; path: string; fullPath: string }; error: null }
    | { data: null; error: StorageError }
  > {
    // Buy to unlock
  }
}

Last updated

Was this helpful?