fix: set select false for secret
Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
@@ -77,6 +77,7 @@ export class ServerlessController {
|
||||
type: SnippetType.Function,
|
||||
method: requestMethod,
|
||||
})
|
||||
.select('+secret')
|
||||
.lean()
|
||||
|
||||
const notExistMessage = 'serverless function is not exist or not enabled'
|
||||
|
||||
@@ -92,7 +92,7 @@ export class SnippetModel extends BaseModel {
|
||||
@IsOptional()
|
||||
method?: string
|
||||
|
||||
@prop()
|
||||
@prop({ select: false })
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
@Transform(({ value }) => (isNil(value) ? value : stringify(value)))
|
||||
|
||||
@@ -56,7 +56,7 @@ export class SnippetService {
|
||||
async update(id: string, newModel: SnippetModel) {
|
||||
await this.validateTypeAndCleanup(newModel)
|
||||
delete newModel.created
|
||||
const old = await this.model.findById(id).lean()
|
||||
const old = await this.model.findById(id).select('+secret').lean()
|
||||
|
||||
if (!old) {
|
||||
throw new NotFoundException()
|
||||
@@ -172,7 +172,7 @@ export class SnippetService {
|
||||
}
|
||||
|
||||
async getSnippetById(id: string) {
|
||||
const doc = await this.model.findById(id).lean()
|
||||
const doc = await this.model.findById(id).select('+secret').lean()
|
||||
if (!doc) {
|
||||
throw new NotFoundException()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user