Skip to content

Commit

Permalink
Added the file entry fields to the data for a single comic [comixed#33]
Browse files Browse the repository at this point in the history
  • Loading branch information
mcpierce committed Jun 14, 2020
1 parent 06ec554 commit a899bdf
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 0 deletions.
24 changes: 24 additions & 0 deletions comixed-frontend/src/app/comics/models/comic-file-entry.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* ComiXed - A digital comic book library management application.
* Copyright (C) 2019, The ComiXed Project
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses>
*/

export interface ComicFileEntry {
fileNumber: number;
fileName: string;
fileSize: number;
fileType: string;
}
4 changes: 4 additions & 0 deletions comixed-frontend/src/app/comics/models/comic.fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export const COMIC_1: Comic = {
nextIssueId: null,
previousIssueId: null,
fileDetails: FILE_DETAILS_1,
fileEntries: [],
readingLists: []
};

Expand Down Expand Up @@ -146,6 +147,7 @@ export const COMIC_3: Comic = {
nextIssueId: null,
previousIssueId: null,
fileDetails: FILE_DETAILS_1,
fileEntries: [],
readingLists: []
};

Expand Down Expand Up @@ -187,6 +189,7 @@ export const COMIC_4: Comic = {
nextIssueId: null,
previousIssueId: null,
fileDetails: FILE_DETAILS_1,
fileEntries: [],
readingLists: []
};

Expand Down Expand Up @@ -228,5 +231,6 @@ export const COMIC_5: Comic = {
nextIssueId: null,
previousIssueId: null,
fileDetails: FILE_DETAILS_1,
fileEntries: [],
readingLists: []
};
2 changes: 2 additions & 0 deletions comixed-frontend/src/app/comics/models/comic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { Page } from './page';
import { ComicCredit } from './comic-credit';
import { FileDetails } from 'app/comics/models/file-details';
import { ReadingList } from 'app/comics/models/reading-list';
import { ComicFileEntry } from 'app/comics/models/comic-file-entry';

export interface Comic {
id: number;
Expand All @@ -32,6 +33,7 @@ export interface Comic {
baseFilename: string;
missing: boolean;
fileDetails: FileDetails;
fileEntries: ComicFileEntry[];
addedDate: string;
deletedDate: number;
lastUpdatedDate: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ public class Comic {

@OneToMany(mappedBy = "comic", cascade = CascadeType.ALL, orphanRemoval = true)
@OrderColumn(name = "file_number")
@JsonView({
View.ComicDetails.class,
})
List<ComicFileEntry> fileEntries = new ArrayList<>();

@Id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@

package org.comixed.model.comic;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonView;
import javax.persistence.*;
import org.comixed.views.View;

@Entity
@Table(name = "comic_file_entries")
Expand All @@ -32,15 +35,31 @@ public class ComicFileEntry {
private Comic comic;

@Column(name = "file_number", nullable = false, updatable = false)
@JsonProperty("fileNumber")
@JsonView({
View.ComicDetails.class,
})
private Integer fileNumber;

@Column(name = "file_name", nullable = false, updatable = false, length = 1024)
@JsonProperty("fileName")
@JsonView({
View.ComicDetails.class,
})
private String fileName;

@Column(name = "file_size", nullable = false, updatable = false)
@JsonProperty("fileSize")
@JsonView({
View.ComicDetails.class,
})
private Integer fileSize;

@Column(name = "file_type", nullable = false, updatable = false, length = 256)
@JsonProperty("fileType")
@JsonView({
View.ComicDetails.class,
})
private String fileType;

public ComicFileEntry() {}
Expand Down

0 comments on commit a899bdf

Please sign in to comment.