|
| 1 | +export class FileCriteria { |
| 2 | + constructor( |
| 3 | + public readonly orderCriteria: FileOrderCriteria = FileOrderCriteria.NAME_AZ, |
| 4 | + public readonly contentType?: string, |
| 5 | + public readonly accessStatus?: FileAccessStatus, |
| 6 | + public readonly categoryName?: string, |
| 7 | + public readonly searchText?: string, |
| 8 | + ) {} |
| 9 | + |
| 10 | + withOrderCriteria(orderCriteria: FileOrderCriteria): FileCriteria { |
| 11 | + return new FileCriteria(orderCriteria, this.contentType, this.accessStatus, this.categoryName); |
| 12 | + } |
| 13 | + |
| 14 | + withContentType(contentType: string | undefined): FileCriteria { |
| 15 | + return new FileCriteria(this.orderCriteria, contentType, this.accessStatus, this.categoryName); |
| 16 | + } |
| 17 | + |
| 18 | + withAccessStatus(accessStatus: FileAccessStatus | undefined): FileCriteria { |
| 19 | + return new FileCriteria(this.orderCriteria, this.contentType, accessStatus, this.categoryName); |
| 20 | + } |
| 21 | + |
| 22 | + withCategoryName(categoryName: string | undefined): FileCriteria { |
| 23 | + return new FileCriteria(this.orderCriteria, this.contentType, this.accessStatus, categoryName); |
| 24 | + } |
| 25 | + |
| 26 | + withSearchText(searchText: string | undefined): FileCriteria { |
| 27 | + return new FileCriteria(this.orderCriteria, this.contentType, this.accessStatus, this.categoryName, searchText); |
| 28 | + } |
| 29 | +} |
| 30 | + |
| 31 | +export enum FileOrderCriteria { |
| 32 | + NAME_AZ = 'NameAZ', |
| 33 | + NAME_ZA = 'NameZA', |
| 34 | + NEWEST = 'Newest', |
| 35 | + OLDEST = 'Oldest', |
| 36 | + SIZE = 'Size', |
| 37 | + TYPE = 'Type', |
| 38 | +} |
| 39 | + |
| 40 | +export enum FileAccessStatus { |
| 41 | + PUBLIC = 'Public', |
| 42 | + RESTRICTED = 'Restricted', |
| 43 | + EMBARGOED = 'EmbargoedThenRestricted', |
| 44 | + EMBARGOED_RESTRICTED = 'EmbargoedThenPublic', |
| 45 | +} |
0 commit comments