i'm trying to make a signup methode in nestJs. But the matter is that when i use my POST request to create a new user, my database don't add this new user in her list of users.
I created this method:
createUser(data: AuthDto){
const user = {
pseudo: data.username,
password: data.password,
pointEffort: 10,
roleId: 2,
id: 5
};
console.log(user);
const result = this.usersRepository.create(user);
return result;
}
The communication with the database works cause i can get the user i already created in phpmyadmin when i insert them with an SQL request.
Here are the entity in my nestJs:
import { Place } from "src/place/place.entity";
import { Science } from "src/science/science.entity";
import { TechnologieUser } from "src/technologie/technologieUser.entity";
import { Column, Entity, ManyToMany, ManyToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";
import { Role } from "./role.entity";
@Entity()
export class User {
@PrimaryGeneratedColumn()
id: Number;
@Column()
pseudo: String;
@Column()
password: String;
@Column()
pointEffort: Number;
@ManyToOne(type => Role, role => role.users)
role: Role;
@ManyToMany(type => Science, science => science.users)
scienceTab: Science[];
@OneToMany(type => TechnologieUser, technologieUser => technologieUser.user)
technologieTab: TechnologieUser[];
@OneToMany(type => Place, place => place.user)
inventaire: Place[];
}
And here the user table: enter image description here
So when i click on a button to create a user, my request get sent and return the new user in the console.log but i never see this new user in my database. Thx for your help