mirror of https://github.com/fantasticit/think.git
Merge pull request #12 from fantasticit/bugfix/createWiki
This commit is contained in:
commit
ca7f18e640
|
@ -300,9 +300,13 @@ export class DocumentService {
|
||||||
userId: user.id,
|
userId: user.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
const query = this.documentRepo.createQueryBuilder('documemt');
|
const [docs] = await this.documentRepo.findAndCount({ createUserId: user.id });
|
||||||
query.select('MAX(documemt.index)', 'maxIndex');
|
const maxIndex = docs.length
|
||||||
const { maxIndex } = await query.getRawOne();
|
? Math.max.apply(
|
||||||
|
[],
|
||||||
|
docs.map((doc) => +doc.index)
|
||||||
|
)
|
||||||
|
: -1;
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
...dto,
|
...dto,
|
||||||
|
|
Loading…
Reference in New Issue