@@ -17,26 +17,27 @@ export class StructureInformation implements AppEntity {
17
17
public createdAt ?: Date ;
18
18
public updatedAt ?: Date ;
19
19
public version ?: number ;
20
- constructor ( options : Partial < StructureInformation > ) {
21
- this . title = options . title || "" ;
22
- this . description = options . description || "" ;
23
- this . startDate = options . startDate || null ;
24
- this . endDate = options . endDate || null ;
25
- this . type = options . type || "other" ;
26
- this . createdAt = createDate ( options . createdAt ) ?? new Date ( ) ;
27
- this . updatedAt = createDate ( options . updatedAt ) ?? new Date ( ) ;
28
- this . createdBy = options . createdBy ;
29
- this . structureId = options . structureId ;
30
- this . isTemporary = options . isTemporary ;
20
+ constructor ( options ? : Partial < StructureInformation > ) {
21
+ this . title = options ? .title || "" ;
22
+ this . description = options ? .description || "" ;
23
+ this . startDate = options ? .startDate || null ;
24
+ this . endDate = options ? .endDate || null ;
25
+ this . type = options ? .type || "other" ;
26
+ this . createdAt = createDate ( options ? .createdAt ) ?? new Date ( ) ;
27
+ this . updatedAt = createDate ( options ? .updatedAt ) ?? new Date ( ) ;
28
+ this . createdBy = options ? .createdBy ;
29
+ this . structureId = options ? .structureId ;
30
+ this . isTemporary = options ? .isTemporary ;
31
31
this . isExpired = isMessageExpired ( options ) ;
32
- this . uuid = options . uuid ;
33
- this . version = options . version ;
32
+ this . uuid = options ? .uuid ;
33
+ this . version = options ? .version ;
34
34
}
35
35
}
36
36
37
37
export function isMessageExpired (
38
- message : Partial < StructureInformation >
39
- ) : boolean {
38
+ message ?: Partial < StructureInformation >
39
+ ) : boolean | undefined {
40
+ if ( ! message ) return undefined ;
40
41
if ( ! message . endDate || ! message . startDate || ! message . isTemporary )
41
42
return false ;
42
43
const today = new Date ( ) ;
0 commit comments