Fix bug in deletionkeys
This commit is contained in:
parent
92e44aea66
commit
ec3e58d1b2
|
@ -33,12 +33,15 @@ export class ImageDBService {
|
||||||
if (withDeleteKey) imageEntity.delete_key = generateRandomString(32);
|
if (withDeleteKey) imageEntity.delete_key = generateRandomString(32);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
imageEntity = await this.imageRepo.save(imageEntity, { reload: true });
|
imageEntity = await this.imageRepo.save(imageEntity, {
|
||||||
|
reload: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (imageEntity.delete_key === null) delete imageEntity.delete_key;
|
||||||
|
return imageEntity;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return Fail(FT.Database, e);
|
return Fail(FT.Database, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return imageEntity;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async findOne(
|
public async findOne(
|
||||||
|
|
|
@ -141,6 +141,7 @@ export class RoleDbService {
|
||||||
try {
|
try {
|
||||||
const found = await this.rolesRepository.find({
|
const found = await this.rolesRepository.find({
|
||||||
where: { name: In(names) },
|
where: { name: In(names) },
|
||||||
|
order: { name: 'ASC' },
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!found) return Fail(FT.NotFound, 'No roles found');
|
if (!found) return Fail(FT.NotFound, 'No roles found');
|
||||||
|
@ -152,7 +153,9 @@ export class RoleDbService {
|
||||||
|
|
||||||
public async findAll(): AsyncFailable<ERoleBackend[]> {
|
public async findAll(): AsyncFailable<ERoleBackend[]> {
|
||||||
try {
|
try {
|
||||||
const found = await this.rolesRepository.find();
|
const found = await this.rolesRepository.find({
|
||||||
|
order: { name: 'ASC' },
|
||||||
|
});
|
||||||
if (!found) return Fail(FT.NotFound, 'No roles found');
|
if (!found) return Fail(FT.NotFound, 'No roles found');
|
||||||
return found;
|
return found;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -224,6 +224,7 @@ export class UserDbService {
|
||||||
const [users, amount] = await this.usersRepository.findAndCount({
|
const [users, amount] = await this.usersRepository.findAndCount({
|
||||||
take: count,
|
take: count,
|
||||||
skip: count * page,
|
skip: count * page,
|
||||||
|
order: { username: 'ASC' },
|
||||||
});
|
});
|
||||||
|
|
||||||
if (users === undefined) return Fail(FT.NotFound, 'Users not found');
|
if (users === undefined) return Fail(FT.NotFound, 'Users not found');
|
||||||
|
|
|
@ -24,10 +24,7 @@ export class EImageBackend implements EImage {
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
transformer: {
|
select: false,
|
||||||
from: (value: string | null) => (value === null ? undefined : value),
|
|
||||||
to: (value: string | undefined) => (value === undefined ? null : value),
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
delete_key?: string;
|
delete_key?: string;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue