Commit cc6e3bf2 authored by Lorenzo Trujillo Rojas's avatar Lorenzo Trujillo Rojas
Browse files

Se crearon las implementaciones de repositorio y datasource para desarrollo

parent 35c3e642
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
import { IOption } from '../../../../common/domain/entities/option';
import { ProfileDataSource } from '../../../domain/datasources/profile_datasource';
export class ProfileDataSourceDev implements ProfileDataSource {
    async getInterests(): Promise<IOption[]> {
        return [
            { id: 1, name: 'Tecnología', isSelected: false },
            { id: 2, name: 'Deportes', isSelected: false },
            { id: 3, name: 'Cine', isSelected: false},
            { id: 4, name: 'Música', isSelected: false },
            { id: 5, name: 'Ciencia',  isSelected: false },
            { id: 6, name: 'Historia', isSelected: false },
            { id: 7, name: 'Arte', isSelected: false },
            { id: 8, name: 'Cocina', isSelected: false },
            { id: 9, name: 'Viajes', isSelected: false },
            { id: 10, name: 'Moda', isSelected: false },
        ];
    }

    async saveInterests(options: IOption[]): Promise<void> {
        console.log('Saving interests', options);
    }

    async setUpProfile(birthdate: string, interests: IOption[]): Promise<void> {
        console.log('Setting up profile', birthdate, interests);
    }
}
 No newline at end of file
+18 −0
Original line number Diff line number Diff line
import { IOption } from "../../../common/domain/entities/option";
import { ProfileDataSource } from "../../domain/datasources/profile_datasource";
import { ProfileRepository } from "../../domain/repositories/profile_repository";

export class ProfileRepositoryImpl implements ProfileRepository {
    constructor(
        private dataSource: ProfileDataSource
    ){}
    async getInterests() {
        return this.dataSource.getInterests();
    }
    async saveInterests(options: IOption[]) {
        return this.dataSource.saveInterests(options);
    }
    async setUpProfile(birthdate: string, interests: IOption[]) {
        return this.dataSource.setUpProfile(birthdate, interests);
    }
}
 No newline at end of file