-
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 branch 'develop' of https://github.com/atlp-rwanda/e-commerce-n…
…injas-bn into ft-login-user-187584915
- Loading branch information
Showing
20 changed files
with
688 additions
and
213 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 |
---|---|---|
@@ -1,10 +1,28 @@ | ||
PORT= | ||
NODE_ENV= | ||
NODE_EN= | ||
DOCKER_DATABASE_HOST_AUTH_METHOD= | ||
DOCKER_DATABASE_NAME= | ||
DOCKER_DATABASE_PASSWORD= | ||
JWT_SECRET= | ||
NODE_ENV= | ||
|
||
SMTP_HOST_PORT= | ||
MP= | ||
SMTP_HOST= | ||
MAIL_ID= | ||
|
||
CLOUD_NAME= | ||
API_KEY= | ||
API_SECRET= | ||
|
||
SERVER_URL_DEV= | ||
SERVER_URL_PRO= | ||
|
||
DATABASE_URL_DEV= | ||
DATABASE_URL_TEST= | ||
DATABASE_URL_PRO= | ||
DB_HOST_TYPE= | ||
|
||
|
||
|
||
DB_HOST_TYPE= | ||
DOCKER_DATABASE_USER= | ||
DOCKER_DATABASE_HOST_AUTH_METHOD= | ||
DOCKER_DATABASE_NAME= | ||
DOCKER_DATABASE_PASSWORD= |
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,7 @@ | ||
{ | ||
"check-coverage": true, | ||
"lines": 80, | ||
"functions": 80, | ||
"branches": 80, | ||
"statements": 80 | ||
} |
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
88 changes: 44 additions & 44 deletions
88
...igrations/20240523180022-create-tokens.ts → ...rations/20240523180022-create-sessions.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 |
---|---|---|
@@ -1,44 +1,44 @@ | ||
import { QueryInterface, DataTypes } from "sequelize"; | ||
export default { | ||
up: async (queryInterface: QueryInterface) => { | ||
await queryInterface.createTable("tokens", { | ||
id: { | ||
type: DataTypes.INTEGER, | ||
autoIncrement: true, | ||
primaryKey: true | ||
}, | ||
userId: { | ||
type: new DataTypes.INTEGER, | ||
allowNull: false | ||
}, | ||
device: { | ||
type: new DataTypes.STRING(280), | ||
allowNull: true | ||
}, | ||
accessToken: { | ||
type: new DataTypes.STRING(280), | ||
allowNull: true | ||
}, | ||
verifyToken: { | ||
type: new DataTypes.STRING(280), | ||
allowNull: true | ||
}, | ||
createdAt: { | ||
field: "createdAt", | ||
type: DataTypes.DATE, | ||
allowNull: false, | ||
defaultValue: DataTypes.NOW | ||
}, | ||
updatedAt: { | ||
field: "updatedAt", | ||
type: DataTypes.DATE, | ||
allowNull: false, | ||
defaultValue: DataTypes.NOW | ||
} | ||
}); | ||
}, | ||
|
||
down: async (queryInterface: QueryInterface) => { | ||
await queryInterface.dropTable("tokens"); | ||
} | ||
}; | ||
import { QueryInterface, DataTypes } from "sequelize"; | ||
export default { | ||
up: async (queryInterface: QueryInterface) => { | ||
await queryInterface.createTable("sessions", { | ||
id: { | ||
type: DataTypes.INTEGER, | ||
autoIncrement: true, | ||
primaryKey: true | ||
}, | ||
userId: { | ||
type: new DataTypes.INTEGER, | ||
allowNull: false | ||
}, | ||
device: { | ||
type: new DataTypes.STRING(280), | ||
allowNull: true | ||
}, | ||
token: { | ||
type: new DataTypes.STRING(280), | ||
allowNull: true | ||
}, | ||
otp: { | ||
type: new DataTypes.STRING(280), | ||
allowNull: true | ||
}, | ||
createdAt: { | ||
field: "createdAt", | ||
type: DataTypes.DATE, | ||
allowNull: false, | ||
defaultValue: DataTypes.NOW | ||
}, | ||
updatedAt: { | ||
field: "updatedAt", | ||
type: DataTypes.DATE, | ||
allowNull: false, | ||
defaultValue: DataTypes.NOW | ||
} | ||
}); | ||
}, | ||
|
||
down: async (queryInterface: QueryInterface) => { | ||
await queryInterface.dropTable("sessions"); | ||
} | ||
}; |
146 changes: 73 additions & 73 deletions
146
src/databases/models/tokens.ts → src/databases/models/session.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 |
---|---|---|
@@ -1,73 +1,73 @@ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
/* eslint-disable require-jsdoc */ | ||
import { Model, DataTypes } from "sequelize"; | ||
import sequelizeConnection from "../config/db.config"; | ||
export interface TokenAttributes { | ||
id: number; | ||
userId: number; | ||
device: string; | ||
accessToken: string; | ||
verifyToken: string; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
} | ||
|
||
class Tokens extends Model<TokenAttributes> implements TokenAttributes { | ||
declare id: number; | ||
declare userId: number; | ||
declare device: string; | ||
declare accessToken: string; | ||
declare verifyToken:string; | ||
declare createdAt: Date; | ||
declare updatedAt: Date; | ||
|
||
static associate(models: any) { | ||
Tokens.belongsTo(models.Users, { foreignKey: "userId",as: "user" }); | ||
} | ||
} | ||
|
||
Tokens.init( | ||
{ | ||
id: { | ||
type: DataTypes.INTEGER, | ||
autoIncrement: true, | ||
primaryKey: true | ||
}, | ||
userId: { | ||
type: new DataTypes.INTEGER, | ||
allowNull: false | ||
}, | ||
device: { | ||
type: new DataTypes.STRING(280), | ||
allowNull: true | ||
}, | ||
accessToken: { | ||
type: new DataTypes.STRING(280), | ||
allowNull: true | ||
}, | ||
verifyToken: { | ||
type: new DataTypes.STRING(280), | ||
allowNull: true | ||
}, | ||
createdAt: { | ||
field: "createdAt", | ||
type: DataTypes.DATE, | ||
allowNull: false, | ||
defaultValue: DataTypes.NOW | ||
}, | ||
updatedAt: { | ||
field: "updatedAt", | ||
type: DataTypes.DATE, | ||
allowNull: false, | ||
defaultValue: DataTypes.NOW | ||
} | ||
}, | ||
{ | ||
sequelize: sequelizeConnection, | ||
tableName: "tokens", | ||
timestamps: true, | ||
modelName:"Tokens" | ||
} | ||
); | ||
|
||
export default Tokens; | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
/* eslint-disable require-jsdoc */ | ||
import { Model, DataTypes } from "sequelize"; | ||
import sequelizeConnection from "../config/db.config"; | ||
export interface SessionAttributes { | ||
id: number; | ||
userId: number; | ||
device: string; | ||
token: string; | ||
otp: string; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
} | ||
|
||
class Session extends Model<SessionAttributes> implements SessionAttributes { | ||
declare id: number; | ||
declare userId: number; | ||
declare device: string; | ||
declare token: string; | ||
declare otp:string; | ||
declare createdAt: Date; | ||
declare updatedAt: Date; | ||
|
||
static associate(models: any) { | ||
Session.belongsTo(models.Users, { foreignKey: "userId",as: "user" }); | ||
} | ||
} | ||
|
||
Session.init( | ||
{ | ||
id: { | ||
type: DataTypes.INTEGER, | ||
autoIncrement: true, | ||
primaryKey: true | ||
}, | ||
userId: { | ||
type: new DataTypes.INTEGER, | ||
allowNull: false | ||
}, | ||
device: { | ||
type: new DataTypes.STRING(280), | ||
allowNull: true | ||
}, | ||
token: { | ||
type: new DataTypes.STRING(280), | ||
allowNull: true | ||
}, | ||
otp: { | ||
type: new DataTypes.STRING(280), | ||
allowNull: true | ||
}, | ||
createdAt: { | ||
field: "createdAt", | ||
type: DataTypes.DATE, | ||
allowNull: false, | ||
defaultValue: DataTypes.NOW | ||
}, | ||
updatedAt: { | ||
field: "updatedAt", | ||
type: DataTypes.DATE, | ||
allowNull: false, | ||
defaultValue: DataTypes.NOW | ||
} | ||
}, | ||
{ | ||
sequelize: sequelizeConnection, | ||
tableName: "sessions", | ||
timestamps: true, | ||
modelName:"Sessions" | ||
} | ||
); | ||
|
||
export default Session; |
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
Oops, something went wrong.