Skip to content

Commit

Permalink
remove "slug" from mediaItem (#510)
Browse files Browse the repository at this point in the history
  • Loading branch information
bonukai authored May 14, 2023
1 parent 98fe658 commit 9b27ec9
Show file tree
Hide file tree
Showing 33 changed files with 230 additions and 187 deletions.
4 changes: 0 additions & 4 deletions server/__tests__/__utils__/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export class Data {
mediaType: 'tv',
source: 'tmdb',
title: 'title',
slug: 'title',
poster: 'posterUrl',
backdrop: 'backdropUrl',
releaseDate: '2002-05-07',
Expand Down Expand Up @@ -75,7 +74,6 @@ export class Data {
mediaType: 'movie',
source: 'tmdb',
title: 'movie',
slug: 'movie',
poster: 'posterUrl',
backdrop: 'backdropUrl',
releaseDate: '2001-04-12',
Expand All @@ -89,7 +87,6 @@ export class Data {
mediaType: 'video_game',
source: 'imdb',
title: 'video_game',
slug: 'video_game',
poster: 'posterUrl',
backdrop: 'backdropUrl',
};
Expand All @@ -100,7 +97,6 @@ export class Data {
mediaType: 'book',
source: 'openlibrary',
title: 'book',
slug: 'book',
poster: 'posterUrl',
backdrop: 'backdropUrl',
};
Expand Down
10 changes: 0 additions & 10 deletions server/__tests__/controllers/import/trakttvController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ describe('TraktTv import', () => {
title: Data.movie.title,
year: parseISO(Data.movie.releaseDate).getFullYear(),
ids: {
slug: Data.movie.slug,
tmdb: Data.movie.tmdbId,
},
},
Expand All @@ -96,7 +95,6 @@ describe('TraktTv import', () => {
title: Data.tvShow.title,
year: parseISO(Data.tvShow.releaseDate).getFullYear(),
ids: {
slug: Data.tvShow.slug,
tmdb: Data.tvShow.tmdbId,
},
},
Expand All @@ -110,7 +108,6 @@ describe('TraktTv import', () => {
title: Data.tvShow.title,
year: parseISO(Data.tvShow.releaseDate).getFullYear(),
ids: {
slug: Data.tvShow.slug,
tmdb: Data.tvShow.tmdbId,
},
},
Expand All @@ -131,7 +128,6 @@ describe('TraktTv import', () => {
title: Data.tvShow.title,
year: parseISO(Data.tvShow.releaseDate).getFullYear(),
ids: {
slug: Data.tvShow.slug,
tmdb: Data.tvShow.tmdbId,
},
},
Expand Down Expand Up @@ -159,7 +155,6 @@ describe('TraktTv import', () => {
title: Data.movie.title,
year: parseISO(Data.movie.releaseDate).getFullYear(),
ids: {
slug: Data.movie.slug,
tmdb: Data.movie.tmdbId,
},
},
Expand All @@ -183,7 +178,6 @@ describe('TraktTv import', () => {
title: Data.tvShow.title,
year: parseISO(Data.tvShow.releaseDate).getFullYear(),
ids: {
slug: Data.tvShow.slug,
tmdb: Data.tvShow.tmdbId,
},
},
Expand Down Expand Up @@ -215,7 +209,6 @@ describe('TraktTv import', () => {
title: Data.movie.title,
year: parseISO(Data.movie.releaseDate).getFullYear(),
ids: {
slug: Data.movie.slug,
tmdb: Data.movie.tmdbId,
},
},
Expand All @@ -228,7 +221,6 @@ describe('TraktTv import', () => {
title: Data.tvShow.title,
year: parseISO(Data.tvShow.releaseDate).getFullYear(),
ids: {
slug: Data.tvShow.slug,
tmdb: Data.tvShow.tmdbId,
},
},
Expand All @@ -241,7 +233,6 @@ describe('TraktTv import', () => {
title: Data.tvShow.title,
year: parseISO(Data.tvShow.releaseDate).getFullYear(),
ids: {
slug: Data.tvShow.slug,
tmdb: Data.tvShow.tmdbId,
},
},
Expand All @@ -261,7 +252,6 @@ describe('TraktTv import', () => {
title: Data.tvShow.title,
year: parseISO(Data.tvShow.releaseDate).getFullYear(),
ids: {
slug: Data.tvShow.slug,
tmdb: Data.tvShow.tmdbId,
},
},
Expand Down
1 change: 0 additions & 1 deletion server/__tests__/migrations/foreignKeys.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { clearDatabase, runMigrations } from '__tests__/__utils__/utils';
const mediaItem = {
id: 1,
title: 'title',
slug: 'title',
source: 'user',
};

Expand Down
18 changes: 16 additions & 2 deletions server/__tests__/migrations/migrations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ import { MediaItemBase } from 'src/entity/mediaItem';
import { Database } from 'src/dbconfig';
import { randomSlugId, toSlug } from 'src/slug';
import { nanoid } from 'nanoid';
import { listRepository } from 'src/repository/list';
import { ListSortBy } from 'src/entity/list';
import { listItemRepository } from 'src/repository/listItemRepository';

describe('migrations', () => {
beforeAll(async () => {
Expand Down Expand Up @@ -1691,5 +1689,21 @@ describe('migrations', () => {
);
});

test('20230514000000_dropMediaItemSlug', async () => {
await Database.knex.migrate.up({
name: `20230514000000_dropMediaItemSlug.${Config.MIGRATIONS_EXTENSION}`,
directory: Config.MIGRATIONS_DIRECTORY,
});

await Database.knex.migrate.down({
directory: Config.MIGRATIONS_DIRECTORY,
});

await Database.knex.migrate.up({
name: `20230514000000_dropMediaItemSlug.${Config.MIGRATIONS_EXTENSION}`,
directory: Config.MIGRATIONS_DIRECTORY,
});
});

afterAll(clearDatabase);
});
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const mediaItem: MediaItemBaseWithSeasons[] = [
mediaType: 'tv',
source: 'user',
title: 'title',
slug: 'title',
seasons: [
{
id: 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ const mediaItem: MediaItemBaseWithSeasons = {
mediaType: 'tv',
source: 'user',
title: 'title',
slug: 'title',
seasons: [
{
id: 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const mediaItem: MediaItemBase = {
mediaType: 'tv',
source: 'user',
title: 'title',
slug: 'title',
};

const user: User = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ const mediaItem: MediaItemBaseWithSeasons = {
mediaType: 'tv',
source: 'user',
title: 'title',
slug: 'title',
};

const seasons: TvSeason[] = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ const mediaItem: MediaItemBaseWithSeasons[] = [
mediaType: 'tv',
source: 'user',
title: 'title',
slug: 'title',
seasons: [
{
id: 1,
Expand Down Expand Up @@ -136,23 +135,20 @@ const mediaItem: MediaItemBaseWithSeasons[] = [
mediaType: 'tv',
source: 'user',
title: 'title2',
slug: 'title2',
},
{
id: 3,
lastTimeUpdated: new Date().getTime(),
mediaType: 'movie',
source: 'user',
title: 'title3',
slug: 'title3',
},
{
id: 4,
lastTimeUpdated: new Date().getTime(),
mediaType: 'tv',
source: 'user',
title: 'title4',
slug: 'title4',
seasons: [
{
id: 3,
Expand Down Expand Up @@ -189,7 +185,6 @@ const mediaItem: MediaItemBaseWithSeasons[] = [
mediaType: 'tv',
source: 'user',
title: 'title5',
slug: 'title5',
seasons: [
{
id: 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ const mediaItem: MediaItemBaseWithSeasons[] = [
mediaType: 'tv',
source: 'user',
title: 'title',
slug: 'title',
seasons: [
{
id: 1,
Expand Down Expand Up @@ -109,23 +108,20 @@ const mediaItem: MediaItemBaseWithSeasons[] = [
mediaType: 'tv',
source: 'user',
title: 'title2',
slug: 'title2',
},
{
id: 3,
lastTimeUpdated: new Date().getTime(),
mediaType: 'movie',
source: 'user',
title: 'title3',
slug: 'title3',
},
{
id: 4,
lastTimeUpdated: new Date().getTime(),
mediaType: 'tv',
source: 'user',
title: 'title4',
slug: 'title4',
seasons: [
{
id: 3,
Expand Down Expand Up @@ -162,7 +158,6 @@ const mediaItem: MediaItemBaseWithSeasons[] = [
mediaType: 'tv',
source: 'user',
title: 'title5',
slug: 'title5',
seasons: [
{
id: 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ const mediaItem: MediaItemBase = {
mediaType: 'book',
source: 'user',
title: 'title',
slug: 'title',
};

const date = new Date().getTime();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ const mediaItem: MediaItemBase = {
source: 'user',
status: 'status',
title: 'title',
slug: 'title-2021',
tmdbId: 4351,
tmdbRating: 9.1,
tvmazeId: 123845,
Expand Down
6 changes: 0 additions & 6 deletions server/__tests__/repository/mediaItem/getItems/seen.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ const mediaItem: MediaItemBaseWithSeasons[] = [
mediaType: 'tv',
source: 'user',
title: 'title',
slug: 'title',
seasons: [
{
id: 1,
Expand Down Expand Up @@ -135,23 +134,20 @@ const mediaItem: MediaItemBaseWithSeasons[] = [
mediaType: 'tv',
source: 'user',
title: 'title2',
slug: 'title2',
},
{
id: 3,
lastTimeUpdated: new Date().getTime(),
mediaType: 'movie',
source: 'user',
title: 'title3',
slug: 'title3',
},
{
id: 4,
lastTimeUpdated: new Date().getTime(),
mediaType: 'tv',
source: 'user',
title: 'title4',
slug: 'title4',
seasons: [
{
id: 3,
Expand Down Expand Up @@ -188,7 +184,6 @@ const mediaItem: MediaItemBaseWithSeasons[] = [
mediaType: 'tv',
source: 'user',
title: 'title5',
slug: 'title5',
seasons: [
{
id: 4,
Expand Down Expand Up @@ -223,7 +218,6 @@ const mediaItem: MediaItemBaseWithSeasons[] = [
mediaType: 'movie',
source: 'user',
title: 'title6',
slug: 'title6',
},
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ const mediaItem: MediaItemBaseWithSeasons[] = [
mediaType: 'tv',
source: 'user',
title: 'title',
slug: 'title',
seasons: [
{
id: 1,
Expand Down Expand Up @@ -139,23 +138,20 @@ const mediaItem: MediaItemBaseWithSeasons[] = [
mediaType: 'tv',
source: 'user',
title: 'title2',
slug: 'title2',
},
{
id: 3,
lastTimeUpdated: new Date().getTime(),
mediaType: 'movie',
source: 'user',
title: 'title3',
slug: 'title3',
},
{
id: 4,
lastTimeUpdated: new Date().getTime(),
mediaType: 'tv',
source: 'user',
title: 'title4',
slug: 'title4',
seasons: [
{
id: 3,
Expand Down Expand Up @@ -192,7 +188,6 @@ const mediaItem: MediaItemBaseWithSeasons[] = [
mediaType: 'tv',
source: 'user',
title: 'title5',
slug: 'title5',
seasons: [
{
id: 4,
Expand Down
Loading

0 comments on commit 9b27ec9

Please sign in to comment.