Skip to content

Commit

Permalink
fix(watchlist): Fix github code scanning
Browse files Browse the repository at this point in the history
  • Loading branch information
yalagin committed May 3, 2023
1 parent 469f64d commit 8d731ce
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"axios-rate-limit": "1.3.0",
"bcrypt": "5.1.0",
"bowser": "2.11.0",
"class-validator": "^0.14.0",
"connect-typeorm": "1.1.4",
"cookie-parser": "1.4.6",
"copy-to-clipboard": "3.3.3",
Expand Down
3 changes: 3 additions & 0 deletions server/entity/Watchlist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Media from '@server/entity/Media';
import { User } from '@server/entity/User';
import type { WatchlistItem } from '@server/interfaces/api/discoverInterfaces';
import logger from '@server/logger';
import { IsNumber, IsString } from 'class-validator';
import {
Column,
CreateDateColumn,
Expand Down Expand Up @@ -34,13 +35,15 @@ export class Watchlist implements WatchlistItem {
public ratingKey = '';

@Column({ type: 'varchar' })
@IsString()
public mediaType: MediaType;

@Column({ type: 'varchar' })
title = '';

@Column()
@Index()
@IsNumber()
public tmdbId: number;

@ManyToOne(() => User, (user) => user.watchlists, {
Expand Down
3 changes: 2 additions & 1 deletion server/routes/watchlist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ watchlistRoutes.post<never, Watchlist, Watchlist>(
switch (error.constructor) {
case QueryFailedError:
logger.warn('Something wrong with data watchlist', {
...req.body,
tmdbId: req.body.tmdbId,
mediaType: req.body.mediaType,
label: 'Watchlist',
});
return next({ status: 409, message: 'Something wrong' });
Expand Down
24 changes: 24 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3976,6 +3976,11 @@
resolved "https://registry.yarnpkg.com/@types/unist/-/unist-2.0.6.tgz#250a7b16c3b91f672a24552ec64678eeb1d3a08d"
integrity sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ==

"@types/validator@^13.7.10":
version "13.7.15"
resolved "https://registry.yarnpkg.com/@types/validator/-/validator-13.7.15.tgz#408c99d1b5f0eecc78109c11f896f72d1f026a10"
integrity sha512-yeinDVQunb03AEP8luErFcyf/7Lf7AzKCD0NXfgVoGCCQDNpZET8Jgq74oBgqKld3hafLbfzt/3inUdQvaFeXQ==

"@types/[email protected]":
version "3.3.2"
resolved "https://registry.yarnpkg.com/@types/web-push/-/web-push-3.3.2.tgz#8c32434147c0396415862e86405c9edc9c50fc15"
Expand Down Expand Up @@ -5148,6 +5153,15 @@ cidr-regex@^3.1.1:
dependencies:
ip-regex "^4.1.0"

class-validator@^0.14.0:
version "0.14.0"
resolved "https://registry.yarnpkg.com/class-validator/-/class-validator-0.14.0.tgz#40ed0ecf3c83b2a8a6a320f4edb607be0f0df159"
integrity sha512-ct3ltplN8I9fOwUd8GrP8UQixwff129BkEtuWDKL5W45cQuLd19xqmTLu5ge78YDm/fdje6FMt0hGOhl0lii3A==
dependencies:
"@types/validator" "^13.7.10"
libphonenumber-js "^1.10.14"
validator "^13.7.0"

classnames@^2.2.5:
version "2.3.2"
resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.3.2.tgz#351d813bf0137fcc6a76a16b88208d2560a0d924"
Expand Down Expand Up @@ -8909,6 +8923,11 @@ libnpmversion@^3.0.7:
proc-log "^2.0.0"
semver "^7.3.7"

libphonenumber-js@^1.10.14:
version "1.10.28"
resolved "https://registry.yarnpkg.com/libphonenumber-js/-/libphonenumber-js-1.10.28.tgz#cae7e929cad96cee5ecc9449027192ecba39ee72"
integrity sha512-1eAgjLrZA0+2Wgw4hs+4Q/kEBycxQo8ZLYnmOvZ3AlM8ImAVAJgDPlZtISLEzD1vunc2q8s2Pn7XwB7I8U3Kzw==

[email protected]:
version "2.0.1"
resolved "https://registry.yarnpkg.com/libqp/-/libqp-2.0.1.tgz#b8fed76cc1ea6c9ceff8888169e4e0de70cd5cf2"
Expand Down Expand Up @@ -13525,6 +13544,11 @@ validate-npm-package-name@^4.0.0:
dependencies:
builtins "^5.0.0"

validator@^13.7.0:
version "13.9.0"
resolved "https://registry.yarnpkg.com/validator/-/validator-13.9.0.tgz#33e7b85b604f3bbce9bb1a05d5c3e22e1c2ff855"
integrity sha512-B+dGG8U3fdtM0/aNK4/X8CXq/EcxU2WPrPEkJGslb47qyHsxmbggTWK0yEA4qnYVNF+nxNlN88o14hIcPmSIEA==

vary@~1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"
Expand Down

0 comments on commit 8d731ce

Please sign in to comment.