import { typeCast } from 'hpsfir-ts-extends';
import { TestDao } from '@dao';
import { TestVo } from '@model/vo';
import { AutoWrite, Service } from 'hpsfir-ioc';
import { Log, Logger } from 'hpsfir-log';

@Service()
export class TestService {

  @AutoWrite()
  private testDao!: TestDao;

  @Log(Symbol(TestService.name))
  private logger!: Logger;

  /**
   * hello
   * @returns
   */
  public async hello(): Promise<TestVo[]> {
    this.logger.info('hello');
    const list = (await this.testDao.list())?.map((item) => typeCast<TestVo>(item));
    return list || [];
  }

}
