-
Notifications
You must be signed in to change notification settings - Fork 25
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 #2666 from IDEMSInternational/feat/user-profile-re…
…store Feat!: Auth user db sync
- Loading branch information
Showing
13 changed files
with
116 additions
and
15 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { DataTypes, QueryInterface } from "sequelize"; | ||
import { UmzugOptions } from "umzug"; | ||
|
||
export const up = async (options: UmzugOptions<QueryInterface>) => { | ||
const queryInterface = options.context as QueryInterface; | ||
await queryInterface.addColumn("app_users", "auth_user_id", { | ||
type: DataTypes.STRING, | ||
}); | ||
}; | ||
export const down = async (options: UmzugOptions<QueryInterface>) => { | ||
const queryInterface = options.context as QueryInterface; | ||
await queryInterface.removeColumn("app_users", "auth_user_id"); | ||
}; |
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
24 changes: 24 additions & 0 deletions
24
packages/api/src/endpoints/auth_users/auth_user.controller.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,24 @@ | ||
import { Controller, Get, Param, } from "@nestjs/common"; | ||
import { ApiOperation, ApiParam, ApiTags } from "@nestjs/swagger"; | ||
import { DeploymentHeaders } from "src/modules/deployment.decorators"; | ||
import { DeploymentService } from "src/modules/deployment.service"; | ||
import { AppUser } from "../app_users/app_user.model"; | ||
|
||
@ApiTags("Auth Users") | ||
@Controller("auth_users") | ||
/** | ||
* The auth_users endpoint are a thin wrapper around the app_users table to enable | ||
* user lookup by auth_user_id | ||
*/ | ||
export class AuthUsersController { | ||
constructor(private readonly deploymentService: DeploymentService) {} | ||
|
||
@Get(":auth_user_id") | ||
@ApiParam({ name: "auth_user_id", type: String }) | ||
@ApiOperation({ summary: "Get auth user profile" }) | ||
@DeploymentHeaders() | ||
findOne(@Param("auth_user_id") auth_user_id: string): Promise<AppUser[]> { | ||
const model = this.deploymentService.model(AppUser); | ||
return model.findAll({where:{auth_user_id}}) | ||
} | ||
} |
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,7 @@ | ||
import { AuthUsersController } from './auth_user.controller'; | ||
import { Module } from '@nestjs/common'; | ||
|
||
@Module({ | ||
controllers: [AuthUsersController], | ||
}) | ||
export class AuthUsersModule {} |
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
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