23 lines
821 B
TypeScript
23 lines
821 B
TypeScript
import { environment } from '../../../environments/environment';
|
|
import { DateService } from '../services/date.service';
|
|
|
|
export class Configuration {
|
|
constructor(
|
|
public isAboutDate: boolean = false,
|
|
public isProtectedByPassword: boolean = false,
|
|
public isOwnerNotifiedByEmailOnNewVote: boolean = false,
|
|
public isOwnerNotifiedByEmailOnNewComment: boolean = false,
|
|
public isMaybeAnswerAvailable: boolean = false,
|
|
public areResultsPublic: boolean = true,
|
|
public dateCreated: Date = new Date(Date.now()),
|
|
public expires: Date = DateService.addDaysToDate(
|
|
environment.poll.defaultConfig.expiracyInDays,
|
|
new Date(Date.now())
|
|
)
|
|
) {}
|
|
|
|
public static isArchived(configuration: Configuration): boolean {
|
|
return configuration.expires ? DateService.isDateInPast(configuration.expires) : undefined;
|
|
}
|
|
}
|