-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from NIAEFEUP/fix/post-early-bird-launch-fixes
fix: post early bird launch fixes
- Loading branch information
Showing
11 changed files
with
89 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import type { HttpContext } from '@adonisjs/core/http' | ||
import { Logger } from '@adonisjs/core/logger' | ||
import type { NextFn } from '@adonisjs/core/types/http' | ||
|
||
export default class LogUserMiddleware { | ||
async handle(ctx: HttpContext, next: NextFn) { | ||
await ctx.auth.check() | ||
const user = ctx.auth.user | ||
|
||
if (user) { | ||
ctx.logger = ctx.logger.child({ user_id: user.id }) | ||
ctx.containerResolver.bindValue(Logger, ctx.logger) | ||
} | ||
|
||
return next() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { loggerStorage } from '#lib/adonisjs/logger.js' | ||
import type { HttpContext } from '@adonisjs/core/http' | ||
import type { NextFn } from '@adonisjs/core/types/http' | ||
|
||
export default class SetupLoggerStorageMiddleware { | ||
async handle(ctx: HttpContext, next: NextFn) { | ||
return loggerStorage.run(ctx.logger, next) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
website/database/migrations/1739145873655_alter_participant_profiles_table.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { BaseSchema } from '@adonisjs/lucid/schema' | ||
|
||
export default class extends BaseSchema { | ||
protected tableName = 'participant_profiles' | ||
|
||
async up() { | ||
this.schema.alterTable(this.tableName, (table) => { | ||
table.dropUnique(['phone']) | ||
}) | ||
} | ||
|
||
async down() { | ||
this.schema.alterTable(this.tableName, (table) => { | ||
table.unique(['phone']) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { AsyncLocalStorage } from 'node:async_hooks' | ||
import $logger from '@adonisjs/core/services/logger' | ||
import { Logger } from '@adonisjs/core/logger' | ||
|
||
export const loggerStorage = new AsyncLocalStorage<Logger>() | ||
|
||
export function logger() { | ||
return loggerStorage.getStore() || $logger | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters