Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

fixed enitity issues

Blue Mousedd01093c07da
diff --git a/src/app.module.ts b/src/app.module.ts
index 1c4d1afcd..05ecbfd6b 100644
--- a/src/app.module.ts
+++ b/src/app.module.ts
@@ -12,6 +12,7 @@ import { ProjectModule } from './project/project.module'
import { MailerModule } from './mailer/mailer.module'
import { ActionTokensModule } from './action-tokens/action-tokens.module'
import { ActionToken } from './action-tokens/action-token.entity'
+import { ProjectShare } from './project/entity/project-share.entity'
import { TaskManagerModule } from './task-manager/task-manager.module'
import { WebhookModule } from './webhook/webhook.module'
import { PingModule } from './ping/ping.module'
@@ -26,8 +27,8 @@ import { PingModule } from './ping/ping.module'
username: process.env.MYSQL_USER,
password: process.env.MYSQL_ROOT_PASSWORD,
database: process.env.MYSQL_DATABASE,
- synchronize: true,
- entities: [User, ActionToken, Project],
+ synchronize: false,
+ entities: [User, ActionToken, Project, ProjectShare],
}),
ScheduleModule.forRoot(),
TaskManagerModule,
diff --git a/src/project/entity/project-share.entity.ts b/src/project/entity/project-share.entity.ts
index 8987b0a56..82688cc57 100644
--- a/src/project/entity/project-share.entity.ts
+++ b/src/project/entity/project-share.entity.ts
@@ -1,4 +1,4 @@
-import { Entity, Column, PrimaryColumn, ManyToOne } from 'typeorm'
+import { Entity, Column, ManyToOne, BeforeUpdate, PrimaryGeneratedColumn } from 'typeorm'
import { ApiProperty } from '@nestjs/swagger'
import { User } from '../../user/entities/user.entity'
@@ -6,6 +6,9 @@ import { Project } from './project.entity'
@Entity()
export class ProjectShare {
+ @PrimaryGeneratedColumn('uuid')
+ id: string
+
@ApiProperty({ type: () => User })
@ManyToOne(() => User, user => user.sharedProjects)
user: User
@@ -24,4 +27,9 @@ export class ProjectShare {
@Column({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' })
updated: Date
+
+ @BeforeUpdate()
+ updateTimestamp() {
+ this.updated = new Date
+ }
}