Skip to content

Commit

Permalink
feat: add timestamp to the base dto (DAP-4763)
Browse files Browse the repository at this point in the history
  • Loading branch information
alsakhaev committed Sep 24, 2024
1 parent 73d3eb7 commit 717076d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
2 changes: 2 additions & 0 deletions libs/engine/src/app/services/base/base.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ export type BaseDto = {
id: EntityId
localId: string
authorId: string
blockNumber: number
timestamp: number
}
6 changes: 2 additions & 4 deletions libs/engine/src/app/services/base/base.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export type EntityId = string

export class Base {
id: EntityId = ''
blockNumber: number = 0
timestamp: number = 0
blockNumber: number = 0 // ToDo: fake block number
timestamp: number = 0 // ToDo: fake timestamp

get authorId(): string {
return this.id.split(KeyDelimiter)[0]
Expand All @@ -29,8 +29,6 @@ export class Base {
return getEntity(this.constructor).name
}

// ToDo: add block number

static create<T extends Base>(this: new () => T, data: Partial<T>): T {
const instance = new this()
Object.assign(instance, data)
Expand Down
4 changes: 4 additions & 0 deletions libs/engine/src/app/services/base/base.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ export class BaseRepository<T extends Base> {

await this.saveItem(item, tx)

// ToDo: update timestamp and blockNumber

return item
}

Expand All @@ -147,6 +149,8 @@ export class BaseRepository<T extends Base> {

await this.saveItem(item, tx)

// ToDo: update timestamp and blockNumber

return item
}

Expand Down
2 changes: 2 additions & 0 deletions libs/engine/src/app/services/document/document.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ export class DocumentSerivce {
id: document.id,
localId: document.localId,
authorId: document.authorId,
blockNumber: document.blockNumber,
timestamp: document.timestamp,
metadata: document.metadata,
openWith: document.openWith,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ export class NotificationService {
id: notification.id,
localId: notification.localId,
authorId: notification.authorId,
blockNumber: notification.blockNumber,
timestamp: notification.timestamp,
type: notification.type,
payload: notification.payload,
recipients: notification.recipients,
Expand Down

0 comments on commit 717076d

Please sign in to comment.