Skip to content

Commit 9b22b28

Browse files
committed
FIX auth module
1 parent 1bf3a4d commit 9b22b28

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

service/src/_common/abstracts/abstract.service.schema.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,13 @@ export abstract class AbstractServiceSchema extends AbstractService implements S
175175
if (beforeEvent?.options) options = { ...options, ...beforeEvent.options }
176176
}
177177
}
178+
console.log('this.request?.user', this.request?.user)
178179
const document: Document<T, any, T> = new this._model({
179180
...data,
180181
metadata: {
181-
createdBy: this.request?.user || 'anonymous',
182+
createdBy: this.request?.user?.username || 'anonymous',
182183
createdAt: new Date(),
183-
lastUpdatedBy: this.request?.user || 'anonymous',
184+
lastUpdatedBy: this.request?.user?.username || 'anonymous',
184185
lastUpdatedAt: new Date(),
185186
},
186187
})
@@ -229,7 +230,7 @@ export abstract class AbstractServiceSchema extends AbstractService implements S
229230
.findByIdAndUpdate<Query<T | null, T, any, T>>({ _id }, {
230231
...update,
231232
metadata: {
232-
lastUpdatedBy: this.request?.user || 'anonymous',
233+
lastUpdatedBy: this.request?.user?.username || 'anonymous',
233234
lastUpdatedAt: new Date(),
234235
},
235236
}, {

service/src/app.module.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ import { SettingsModule } from '~/core/settings/settings.module'
109109
providers: [
110110
AppService,
111111
ShutdownService,
112-
// {
113-
// provide: APP_GUARD,
114-
// useClass: AuthGuard,
115-
// },
112+
{
113+
provide: APP_GUARD,
114+
useClass: AuthGuard,
115+
},
116116
{
117117
provide: APP_FILTER,
118118
useClass: MongooseValidationFilter,

0 commit comments

Comments
 (0)