Skip to content

Commit

Permalink
resolve typescript errors
Browse files Browse the repository at this point in the history
  • Loading branch information
nealwp committed Oct 26, 2024
1 parent 6b46c91 commit d034671
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 22 deletions.
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"license": "ISC",
"devDependencies": {
"@faker-js/faker": "^9.1.0",
"@types/express": "^5.0.0",
"@types/express": "^4.17.21",
"@types/jest": "^29.5.14",
"@types/node": "^22.8.1",
"@types/supertest": "^6.0.2",
Expand Down
2 changes: 1 addition & 1 deletion src/models/character.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Character extends Model<CharacterAttributes, CharacterCreationAttributes>
@PrimaryKey
@AutoIncrement
@Column
id!: number;
override id!: number;

@Column
name!: string;
Expand Down
2 changes: 1 addition & 1 deletion src/models/inventory.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Inventory extends Model<InventoryAttributes, InventoryCreationAttributes>
@PrimaryKey
@AutoIncrement
@Column
id!: number;
override id!: number;

@ForeignKey(() => Character)
@Column
Expand Down
2 changes: 1 addition & 1 deletion src/models/weapon.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Weapon extends Model<WeaponAttributes, WeaponCreationAttributes> implement
@PrimaryKey
@AutoIncrement
@Column
id!: number;
override id!: number;

@ForeignKey(() => Inventory)
@Column
Expand Down
6 changes: 3 additions & 3 deletions src/routes/character.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { characters } from '../controllers';

const router = Router();

router.get('/', async (req, res, next) => {
router.get('/', async (_, res) => {
const allCharacters = await characters.findAll();

if (!allCharacters.length) {
Expand All @@ -14,7 +14,7 @@ router.get('/', async (req, res, next) => {
return res.status(200).json(allCharacters);
});

router.get('/:id', async (req, res, next) => {
router.get('/:id', async (req, res) => {
const { id } = req.params;
try {
const character = await characters.findById(+id);
Expand All @@ -25,7 +25,7 @@ router.get('/:id', async (req, res, next) => {
}
});

router.post('/', async (req, res, next) => {
router.post('/', async (req, res) => {
const character: CharacterCreationAttributes = req.body;
const createdCharacter = await characters.create(character);
res.status(201).json(createdCharacter);
Expand Down
6 changes: 3 additions & 3 deletions src/routes/inventory.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import { inventory } from '../controllers';

const router = Router();

router.get('/', async (req, res, next) => {
router.get('/', async (_, res) => {
const allInventories = await inventory.findAll();
if (!allInventories.length) {
return res.status(204).send();
}
return res.status(200).json(allInventories);
});

router.get('/:id', async (req, res, next) => {
router.get('/:id', async (req, res) => {
const { id } = req.params;
try {
const foundInventory = await inventory.findById(+id);
Expand All @@ -23,7 +23,7 @@ router.get('/:id', async (req, res, next) => {
}
});

router.post('/', async (req, res, next) => {
router.post('/', async (req, res) => {
const payload: InventoryCreationAttributes = req.body;
try {
const createdInventory = await inventory.create(payload);
Expand Down
8 changes: 4 additions & 4 deletions src/routes/weapon.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import { WeaponCreationAttributes } from '../@types/weapon.types';

const router = Router();

router.get('/', async (req, res, next) => {
router.get('/', async (_, res, __) => {
const allWeapons = await weapons.findAll();
if (!allWeapons.length) {
return res.status(204).send();
}
return res.status(200).json(allWeapons);
});

router.get('/:id', async (req, res, next) => {
router.get('/:id', async (req, res, _) => {
const { id } = req.params;
try {
const weapon = await weapons.findById(+id);
Expand All @@ -23,7 +23,7 @@ router.get('/:id', async (req, res, next) => {
}
});

router.post('/', async (req, res, next) => {
router.post('/', async (req, res, _) => {
const weapon: WeaponCreationAttributes = req.body;
try {
const createdWeapon = await weapons.create(weapon);
Expand All @@ -34,7 +34,7 @@ router.post('/', async (req, res, next) => {
}
});

router.post('/inventory', async (req, res, next) => {
router.post('/inventory', async (req, res, _) => {
const { id, inventoryId } = req.body as { id: number; inventoryId: number };
try {
const updatedWeapon = await weapons.addToInventory(id, inventoryId);
Expand Down

0 comments on commit d034671

Please sign in to comment.