2020-05-05 18:17:12 +02:00
|
|
|
import { environment } from '../../../environments/environment';
|
|
|
|
import { DateUtilsService } from '../utils/date-utils.service';
|
|
|
|
|
|
|
|
export class Configuration {
|
|
|
|
constructor(
|
|
|
|
public isAboutDate: boolean = false,
|
|
|
|
public isProtectedByPassword: boolean = false,
|
2020-05-12 19:16:23 +02:00
|
|
|
public isOwnerNotifiedByEmail: { onNewVote: boolean; onNewComment: boolean } = {
|
|
|
|
onNewVote: false,
|
|
|
|
onNewComment: false,
|
|
|
|
},
|
2020-05-05 18:17:12 +02:00
|
|
|
public isMaybeAnswerAvailable: boolean = false,
|
2020-05-12 19:16:23 +02:00
|
|
|
public areResultsPublic: boolean = false,
|
|
|
|
public dateCreated: Date = new Date(Date.now()),
|
|
|
|
public expires: Date = DateUtilsService.addDaysToDate(
|
2020-05-05 18:17:12 +02:00
|
|
|
environment.poll.defaultConfig.expiracyInDays,
|
|
|
|
new Date(Date.now())
|
|
|
|
)
|
|
|
|
) {}
|
|
|
|
|
2020-05-12 19:16:23 +02:00
|
|
|
public static isArchived(configuration: Configuration): boolean {
|
|
|
|
return DateUtilsService.isDateInPast(configuration.expires);
|
2020-05-05 18:17:12 +02:00
|
|
|
}
|
|
|
|
}
|