import { Injectable } from '@nestjs/common';
import { Node } from 'neo4j-driver';
import { Neo4jService } from 'src/neo4j/neo4j.service';

export type User = Node;

@Injectable()
export class AppService {
  constructor(private readonly neo4jService: Neo4jService) {}

  async getHello(): Promise<string> {
    const result = await this.neo4jService.read(
      `MATCH (n) RETURN count(n) AS count`,
      {},
    );

    const count = result.records[0].get('count');

    return `${count} nodes in the database`;
  }
}
