Skip to content

Commit

Permalink
Apply expected code style and fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
bkimminich committed Mar 13, 2022
1 parent 0d30a86 commit cadd795
Show file tree
Hide file tree
Showing 56 changed files with 741 additions and 741 deletions.
34 changes: 17 additions & 17 deletions data/datacreator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@
*/

/* jslint node: true */
import {AddressModel} from '../models/address'
import {BasketModel} from '../models/basket'
import {BasketItemModel} from '../models/basketitem'
import {CardModel} from '../models/card'
import {ChallengeModel} from '../models/challenge'
import {ComplaintModel} from '../models/complaint'
import {DeliveryModel} from '../models/delivery'
import {FeedbackModel} from '../models/feedback'
import {MemoryModel} from '../models/memory'
import {ProductModel} from '../models/product'
import {QuantityModel} from '../models/quantity'
import {RecycleModel} from '../models/recycle'
import {SecurityAnswerModel} from '../models/securityAnswer'
import {SecurityQuestionModel} from '../models/securityQuestion'
import {UserModel} from '../models/user'
import {WalletModel} from '../models/wallet'
import { AddressModel } from '../models/address'
import { BasketModel } from '../models/basket'
import { BasketItemModel } from '../models/basketitem'
import { CardModel } from '../models/card'
import { ChallengeModel } from '../models/challenge'
import { ComplaintModel } from '../models/complaint'
import { DeliveryModel } from '../models/delivery'
import { FeedbackModel } from '../models/feedback'
import { MemoryModel } from '../models/memory'
import { ProductModel } from '../models/product'
import { QuantityModel } from '../models/quantity'
import { RecycleModel } from '../models/recycle'
import { SecurityAnswerModel } from '../models/securityAnswer'
import { SecurityQuestionModel } from '../models/securityQuestion'
import { UserModel } from '../models/user'
import { WalletModel } from '../models/wallet'
import { Address, Card, Challenge, Delivery, Memory, Product, SecurityQuestion, User } from './types'
const datacache = require('./datacache')
const config = require('config')
Expand Down Expand Up @@ -601,7 +601,7 @@ async function createSecurityQuestions () {
}

async function createSecurityAnswer (UserId: number, SecurityQuestionId: number, answer: string) {
return await SecurityAnswerModel.create({ SecurityQuestionModelId:SecurityQuestionId, UserModelId:UserId, answer }).catch((err: unknown) => {
return await SecurityAnswerModel.create({ SecurityQuestionModelId: SecurityQuestionId, UserModelId: UserId, answer }).catch((err: unknown) => {
logger.error(`Could not insert SecurityAnswer ${answer} mapped to UserId ${UserId}: ${utils.getErrorMessage(err)}`)
})
}
Expand Down
2 changes: 1 addition & 1 deletion lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import packageJson from '../package.json'
import { Op } from 'sequelize'
import fs = require('fs')
import {ChallengeModel} from '../models/challenge'
import { ChallengeModel } from '../models/challenge'

const colors = require('colors/safe')
const notifications = require('../data/datacache').notifications
Expand Down
86 changes: 43 additions & 43 deletions models/address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,49 +27,49 @@ InferCreationAttributes<AddressModel>
declare country: string
}

const AddressModelInit=(sequelize:Sequelize)=>{
AddressModel.init(
{
UserId:{
type: DataTypes.INTEGER
const AddressModelInit = (sequelize: Sequelize) => {
AddressModel.init(
{
UserId: {
type: DataTypes.INTEGER
},
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
fullName: {
type: DataTypes.STRING
},
mobileNum: {
type: DataTypes.INTEGER,
validate: {
isInt: true,
min: 1000000,
max: 9999999999
}
},
zipCode: {
type: DataTypes.STRING,
validate: {
len: [1, 8]
}
},
streetAddress: {
type: DataTypes.STRING,
validate: {
len: [1, 160]
}
},
city: DataTypes.STRING,
state: DataTypes.STRING,
country: DataTypes.STRING
},
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
fullName: {
type: DataTypes.STRING
},
mobileNum: {
type: DataTypes.INTEGER,
validate: {
isInt: true,
min: 1000000,
max: 9999999999
}
},
zipCode: {
type: DataTypes.STRING,
validate: {
len: [1, 8]
}
},
streetAddress: {
type: DataTypes.STRING,
validate: {
len: [1, 160]
}
},
city: DataTypes.STRING,
state: DataTypes.STRING,
country: DataTypes.STRING
},
{
tableName: 'Addresses',
sequelize
}
)
{
tableName: 'Addresses',
sequelize
}
)
}

export {AddressModel, AddressModelInit}
export { AddressModel, AddressModelInit }
36 changes: 18 additions & 18 deletions models/basket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
NonAttribute,
Sequelize
} from 'sequelize'
import {ProductModel} from './product'
import { ProductModel } from './product'

class BasketModel extends Model<
InferAttributes<BasketModel>,
Expand All @@ -26,24 +26,24 @@ InferCreationAttributes<BasketModel>
declare ProductModels?: NonAttribute<ProductModel[]>
}

const BasketModelInit=(sequelize:Sequelize)=>{
BasketModel.init(
{
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
const BasketModelInit = (sequelize: Sequelize) => {
BasketModel.init(
{
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
coupon: DataTypes.STRING,
UserModelId: {
type: DataTypes.INTEGER
}
},
coupon: DataTypes.STRING,
UserModelId:{
type: DataTypes.INTEGER
{
tableName: 'Baskets',
sequelize
}
},
{
tableName: 'Baskets',
sequelize
}
)
)
}

export {BasketModel,BasketModelInit}
export { BasketModel, BasketModelInit }
42 changes: 21 additions & 21 deletions models/basketitem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,27 @@ InferCreationAttributes<BasketItemModel>
declare quantity: number
}

const BasketItemModelInit=(sequelize:Sequelize)=>{
BasketItemModel.init(
{
ProductId:{
type: DataTypes.INTEGER
const BasketItemModelInit = (sequelize: Sequelize) => {
BasketItemModel.init(
{
ProductId: {
type: DataTypes.INTEGER
},
BasketId: {
type: DataTypes.INTEGER
},
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
quantity: DataTypes.INTEGER
},
BasketId:{
type: DataTypes.INTEGER
},
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
quantity: DataTypes.INTEGER
},
{
tableName: 'BasketItems',
sequelize
}
)
{
tableName: 'BasketItems',
sequelize
}
)
}

export {BasketItemModel,BasketItemModelInit}
export { BasketItemModel, BasketItemModelInit }
28 changes: 14 additions & 14 deletions models/captcha.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@ InferCreationAttributes<CaptchaModel>
declare answer: string
}

const CaptchaModelInit=(sequelize:Sequelize)=>{
CaptchaModel.init(
{
captchaId: {
type: DataTypes.INTEGER,
const CaptchaModelInit = (sequelize: Sequelize) => {
CaptchaModel.init(
{
captchaId: {
type: DataTypes.INTEGER
},
captcha: DataTypes.STRING,
answer: DataTypes.STRING
},
captcha: DataTypes.STRING,
answer: DataTypes.STRING
},
{
tableName: 'Captchas',
sequelize
}
)
{
tableName: 'Captchas',
sequelize
}
)
}

export {CaptchaModel,CaptchaModelInit}
export { CaptchaModel, CaptchaModelInit }
80 changes: 40 additions & 40 deletions models/card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,48 +24,48 @@ InferCreationAttributes<CardModel>
declare expYear: number
}

const CardModelInit=(sequelize:Sequelize)=>{
CardModel.init(
{
UserId:{
type: DataTypes.INTEGER
},
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
fullName: DataTypes.STRING,
cardNum: {
type: DataTypes.INTEGER,
validate: {
isInt: true,
min: 1000000000000000,
max: 9999999999999998
const CardModelInit = (sequelize: Sequelize) => {
CardModel.init(
{
UserId: {
type: DataTypes.INTEGER
},
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
fullName: DataTypes.STRING,
cardNum: {
type: DataTypes.INTEGER,
validate: {
isInt: true,
min: 1000000000000000,
max: 9999999999999998
}
},
expMonth: {
type: DataTypes.INTEGER,
validate: {
isInt: true,
min: 1,
max: 12
}
},
expYear: {
type: DataTypes.INTEGER,
validate: {
isInt: true,
min: 2080,
max: 2099
}
}
},
expMonth: {
type: DataTypes.INTEGER,
validate: {
isInt: true,
min: 1,
max: 12
}
},
expYear: {
type: DataTypes.INTEGER,
validate: {
isInt: true,
min: 2080,
max: 2099
}
{
tableName: 'Cards',
sequelize
}
},
{
tableName: 'Cards',
sequelize
}
)
)
}

export {CardModel,CardModelInit}
export { CardModel, CardModelInit }
Loading

0 comments on commit cadd795

Please sign in to comment.