Skip to content
Snippets Groups Projects
Commit 7b14c808 authored by Hugo SUBTIL's avatar Hugo SUBTIL
Browse files

fix(structure): structure id creation

parent 2f86c0bc
No related branches found
No related tags found
3 merge requests!27Recette,!26Dev,!16Poc/api aptic
import { HttpException, HttpService, Injectable, HttpStatus } from '@nestjs/common';
import { InjectModel } from '@nestjs/mongoose';
import { Document, Types } from 'mongoose';
import { Model } from 'mongoose';
import { Types, Model } from 'mongoose';
import { Observable } from 'rxjs';
import { AxiosResponse } from 'axios';
import { Structure, StructureDocument } from '../schemas/structure.schema';
......@@ -23,6 +22,7 @@ export class StructuresService {
throw new HttpException('Invalid profile', HttpStatus.NOT_FOUND);
}
const createdStructure = new this.structureModel(structureDto);
createdStructure._id = Types.ObjectId();
createdStructure.save();
user.structuresLink.push(createdStructure._id);
user.save();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment