-
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.
[Delivers #187584922] Admin should be able to disable an account (#25)
* [Delivers #187584922] Admin should be able to disable an account * Admin should be able to disable or enable an account * Admin should be able to disable or enable an account * Admin should be able to disable or enable an account * Admin should be able to disable or enable an account * Admin should be able to disable or enable an account * Adjusted the database * DB adjusted * adjusted info * done rebase
- Loading branch information
1 parent
f8e8970
commit 64cf94d
Showing
24 changed files
with
466 additions
and
142 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,8 @@ | ||
{ | ||
"extends": [ | ||
"development" | ||
], | ||
"hints": { | ||
"typescript-config/strict": "off" | ||
} | ||
} |
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
const path = require("path"); | ||
module.exports = { | ||
'config': path.resolve('dist/src','databases', 'config', 'config.js'), | ||
'models-path': path.resolve('dist/src','databases', 'models'), | ||
'seeders-path': path.resolve('dist/src','databases', 'seeders'), | ||
'migrations-path': path.resolve('dist/src','databases', 'migrations') | ||
}; | ||
'config': path.resolve('dist/src', 'databases', 'config', 'config.js'), | ||
'models-path': path.resolve('dist/src', 'databases', 'models'), | ||
'seeders-path': path.resolve('dist/src', 'databases', 'seeders'), | ||
'migrations-path': path.resolve('dist/src', 'databases', 'migrations') | ||
}; |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -108,4 +108,4 @@ | |
"eslint-plugin-import": "^2.29.1", | ||
"lint-staged": "^15.2.2" | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -33,4 +33,4 @@ const sequelizeConfig = { | |
} | ||
}; | ||
|
||
module.exports = sequelizeConfig; | ||
module.exports = sequelizeConfig; |
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 |
---|---|---|
@@ -1,44 +1,44 @@ | ||
import { config } from "dotenv" | ||
import { Sequelize } from "sequelize" | ||
|
||
config() | ||
const NODE_ENV: string = process.env.NODE_ENV || "development" | ||
const DB_HOST_MODE: string = process.env.DB_HOST_TYPE || "remote" | ||
|
||
/** | ||
* Get the URI for the database connection. | ||
* @returns {string} The URI string. | ||
*/ | ||
function getDbUri(): string { | ||
switch (NODE_ENV) { | ||
case "development": | ||
return process.env.DATABASE_URL_DEV as string | ||
case "test": | ||
return process.env.DATABASE_URL_TEST as string | ||
default: | ||
return process.env.DATABASE_URL_PRO as string | ||
} | ||
} | ||
|
||
/** | ||
* Get dialect options for Sequelize. | ||
* @returns {DialectOptions} The dialect options. | ||
*/ | ||
function getDialectOptions() { | ||
return DB_HOST_MODE === "local" | ||
? {} | ||
: { | ||
ssl: { | ||
require: true, | ||
rejectUnauthorized: false | ||
} | ||
} | ||
} | ||
|
||
const sequelizeConnection: Sequelize = new Sequelize(getDbUri(), { | ||
dialect: "postgres", | ||
dialectOptions: getDialectOptions(), | ||
logging: false | ||
}) | ||
|
||
export default sequelizeConnection | ||
import { config } from "dotenv" | ||
import { Sequelize } from "sequelize" | ||
|
||
config() | ||
const NODE_ENV: string = process.env.NODE_ENV || "development" | ||
const DB_HOST_MODE: string = process.env.DB_HOST_TYPE || "remote" | ||
|
||
/** | ||
* Get the URI for the database connection. | ||
* @returns {string} The URI string. | ||
*/ | ||
function getDbUri(): string { | ||
switch (NODE_ENV) { | ||
case "development": | ||
return process.env.DATABASE_URL_DEV as string | ||
case "test": | ||
return process.env.DATABASE_URL_TEST as string | ||
default: | ||
return process.env.DATABASE_URL_PRO as string | ||
} | ||
} | ||
|
||
/** | ||
* Get dialect options for Sequelize. | ||
* @returns {DialectOptions} The dialect options. | ||
*/ | ||
function getDialectOptions() { | ||
return DB_HOST_MODE === "local" | ||
? {} | ||
: { | ||
ssl: { | ||
require: true, | ||
rejectUnauthorized: false | ||
} | ||
} | ||
} | ||
|
||
const sequelizeConnection: Sequelize = new Sequelize(getDbUri(), { | ||
dialect: "postgres", | ||
dialectOptions: getDialectOptions(), | ||
logging: false | ||
}) | ||
|
||
export default sequelizeConnection |
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
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,14 @@ | ||
import { Request, Response } from "express"; | ||
import httpStatus from "http-status"; | ||
import authRepositories from "../../auth/repository/authRepositories"; | ||
|
||
const updateUserStatus = async (req: Request, res: Response): Promise<void> => { | ||
try { | ||
const userId: number = Number(req.params.id); | ||
const data = await authRepositories.UpdateUserByAttributes("status", req.body.status, "id", userId); | ||
res.status(httpStatus.OK).json({ message: "Status updated successfully.", data }); | ||
} catch (error) { | ||
res.status(httpStatus.INTERNAL_SERVER_ERROR).json({ status: httpStatus.INTERNAL_SERVER_ERROR, message: error.message }); | ||
} | ||
}; | ||
export default { updateUserStatus }; |
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 @@ | ||
|
Oops, something went wrong.