-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
138 changed files
with
12,782 additions
and
2,239 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
# | ||
|
||
# API docs | ||
#DOCS=false | ||
DOCS=true | ||
|
||
# API docs path | ||
#DOC_PATH=doc | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
backend/src/notification-comments/wallNotification.entity.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm'; | ||
import { ProjectWallNotification } from '../project-wall-notification/project-wall-notification.entity'; | ||
|
||
@Entity() | ||
export class NotificationComment { | ||
@PrimaryGeneratedColumn({ unsigned: true }) | ||
id: number; | ||
|
||
@Column({ type: 'text' }) | ||
comment: string; | ||
|
||
@Column({ unsigned: true, nullable: true }) | ||
projectWallNotificationId: number; | ||
|
||
@ManyToOne(type => ProjectWallNotification, notification => notification.comments, { onUpdate: 'CASCADE', onDelete: 'CASCADE' }) | ||
notifications: ProjectWallNotification; | ||
} |
30 changes: 30 additions & 0 deletions
30
backend/src/project-wall-notification-comment/comment.entity.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Entity, Column, PrimaryGeneratedColumn, OneToOne, JoinColumn, ManyToOne, OneToMany } from 'typeorm'; | ||
import { User } from '../user/user.entity'; | ||
import { ProjectWallNotification } from '../project-wall-notification/project-wall-notification.entity'; | ||
|
||
@Entity() | ||
export class ProjectWallNotificationComment { | ||
@PrimaryGeneratedColumn({ unsigned: true }) | ||
id: number; | ||
|
||
@Column({ length: 200 }) | ||
author: string; | ||
|
||
@Column({ unsigned: true, type: 'int' }) | ||
projectWallNotificationId: number; | ||
|
||
@Column({ unsigned: true, type: 'int' }) | ||
userId: number; | ||
|
||
@ManyToOne(type => ProjectWallNotification, project => project.comments, { onUpdate: 'CASCADE', onDelete: 'CASCADE' }) | ||
projectWallNotification: ProjectWallNotification; | ||
|
||
@Column({ type: 'text' }) | ||
content: string; | ||
|
||
@Column({ type: 'datetime', default: () => 'CURRENT_TIMESTAMP' }) | ||
created: string; | ||
|
||
@ManyToOne(type => User, user => user.projectWallNotificationComments) | ||
user: User; | ||
} |
41 changes: 41 additions & 0 deletions
41
backend/src/project-wall-notification-comment/dto/create-notification-comment.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import * as Joi from 'joi'; | ||
|
||
export class CreateProjectWallNotificationCommentDto { | ||
|
||
@ApiProperty({ | ||
example: 'Post content.', | ||
description: 'Post content.', | ||
minLength: 1, | ||
type: String, | ||
required: true | ||
}) | ||
content: string; | ||
|
||
@ApiProperty({ | ||
example: 'shanji', | ||
description: 'Authors username', | ||
minLength: 1, | ||
maxLength: 200, | ||
type: String, | ||
required: true | ||
}) | ||
author: string; | ||
|
||
@ApiProperty({ | ||
description: 'User id.', | ||
example: 1, | ||
minimum: 1, | ||
default: 1, | ||
type: Number, | ||
required: true | ||
}) | ||
userId: number; | ||
} | ||
|
||
export const CreateProjectWallNotificationCommentSchema = Joi.object().keys({ | ||
content: Joi.string().min(1).required().default('Work on a project.'), | ||
author: Joi.string().min(1).max(200).default('shanji'), | ||
userId: Joi.number().min(1).required().default(1) | ||
}); | ||
|
8 changes: 8 additions & 0 deletions
8
backend/src/project-wall-notification-comment/dto/project-wall-notification-comment.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export class ProjectWallNotificationCommentDto { | ||
id: number; | ||
author: string; | ||
projectWallNotificationId: number; | ||
userId: number; | ||
content: string; | ||
created: string; | ||
} |
19 changes: 19 additions & 0 deletions
19
backend/src/project-wall-notification-comment/project-wall-notification-comment.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { TypeOrmModule } from '@nestjs/typeorm'; | ||
import { ProjectWallNotificationComment } from './comment.entity'; | ||
import { ProjectWallNotificationCommentService } from './project-wall-notification-comment.service'; | ||
|
||
@Module({ | ||
imports: [ | ||
TypeOrmModule.forFeature([ | ||
ProjectWallNotificationComment | ||
]), | ||
], | ||
providers: [ | ||
ProjectWallNotificationCommentService | ||
], | ||
exports: [ | ||
ProjectWallNotificationCommentService | ||
] | ||
}) | ||
export class ProjectWallNotificationCommentModule { } |
50 changes: 50 additions & 0 deletions
50
backend/src/project-wall-notification-comment/project-wall-notification-comment.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { ConflictException, Injectable, Logger } from '@nestjs/common'; | ||
import { ConfigService } from '@nestjs/config'; | ||
import { InjectEntityManager } from '@nestjs/typeorm'; | ||
import { DeepPartial, EntityManager, In, Not, QueryFailedError } from 'typeorm'; | ||
import { ProjectWallNotificationComment } from './comment.entity'; | ||
import { CreateProjectWallNotificationCommentDto } from './dto/create-notification-comment.dto'; | ||
|
||
@Injectable() | ||
export class ProjectWallNotificationCommentService { | ||
private readonly logger: Logger = new Logger(ProjectWallNotificationCommentService.name); | ||
|
||
constructor( | ||
private readonly configService: ConfigService, | ||
@InjectEntityManager() | ||
private readonly entityManager: EntityManager, | ||
) { } | ||
|
||
async getAll(): Promise<ProjectWallNotificationComment[]> { | ||
return await this.entityManager.find(ProjectWallNotificationComment); | ||
} | ||
|
||
async createNotificationComment(projectWallNotification: CreateProjectWallNotificationCommentDto, notificationId: number, userId: number): Promise<void> { | ||
await this.entityManager.insert(ProjectWallNotificationComment, this.createProjectWallNotificationObject(projectWallNotification, notificationId, userId)); | ||
} | ||
|
||
async getProjectWallNotificationById(projectWallNotificationCommentId: number): Promise<ProjectWallNotificationComment> { | ||
return await this.entityManager.findOneBy(ProjectWallNotificationComment, { id: projectWallNotificationCommentId }); | ||
} | ||
|
||
async getProjectWallNotificationByProjectId(notificationId: number): Promise<ProjectWallNotificationComment[]> { | ||
return await this.entityManager.findBy(ProjectWallNotificationComment, { projectWallNotificationId: notificationId }); | ||
} | ||
|
||
async deleteProjectWallNotificationComment(commentId: number) { | ||
return await this.entityManager.delete(ProjectWallNotificationComment, { id: commentId }); | ||
} | ||
|
||
async deleteProjectWallNotificationByProjectId(notificationId: number) { | ||
return await this.entityManager.delete(ProjectWallNotificationComment, { projectWallNotificationId: notificationId }); | ||
} | ||
|
||
createProjectWallNotificationObject(projectWallNotificationComment: CreateProjectWallNotificationCommentDto, NotificationId: number, userId): ProjectWallNotificationComment { | ||
let projectNotificationCommentObject = new ProjectWallNotificationComment(); | ||
projectNotificationCommentObject.author = projectWallNotificationComment.author; | ||
projectNotificationCommentObject.content = projectWallNotificationComment.content; | ||
projectNotificationCommentObject.projectWallNotificationId = NotificationId | ||
projectNotificationCommentObject.userId = userId; | ||
return projectNotificationCommentObject; | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
backend/src/project-wall-notification/dto/create-notification.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import * as Joi from 'joi'; | ||
|
||
export class CreateProjectWallNotificationDto { | ||
|
||
@ApiProperty({ | ||
example: 'Title.', | ||
description: 'Title.', | ||
minLength: 1, | ||
type: String, | ||
required: true | ||
}) | ||
title: string; | ||
|
||
@ApiProperty({ | ||
example: 'Post content.', | ||
description: 'Post content.', | ||
minLength: 1, | ||
type: String, | ||
required: true | ||
}) | ||
postContent: string; | ||
|
||
@ApiProperty({ | ||
example: 'shanji', | ||
description: 'Authors username', | ||
minLength: 1, | ||
maxLength: 200, | ||
type: String, | ||
required: true | ||
}) | ||
author: string; | ||
|
||
@ApiProperty({ | ||
description: 'User id.', | ||
example: 1, | ||
minimum: 1, | ||
default: 1, | ||
type: Number, | ||
required: true | ||
}) | ||
userId: number; | ||
} | ||
|
||
export const CreateProjectWallNotificationSchema = Joi.object().keys({ | ||
title: Joi.string().min(1).max(200).required().default('Work on a project.'), | ||
postContent: Joi.string().min(1).required().default('Work on a project.'), | ||
author: Joi.string().min(1).max(200).default('shanji'), | ||
userId: Joi.number().min(1).required().default(1) | ||
}); | ||
|
12 changes: 12 additions & 0 deletions
12
backend/src/project-wall-notification/dto/project-wall-notification.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { ProjectWallNotificationCommentDto } from "../../project-wall-notification-comment/dto/project-wall-notification-comment.dto"; | ||
|
||
export class ProjectWallNotificationDto { | ||
id: number; | ||
author: string; | ||
title: string; | ||
projectId: number; | ||
userId: number; | ||
postContent?: string | null; | ||
created: string; | ||
comments: ProjectWallNotificationCommentDto[]; | ||
} |
37 changes: 37 additions & 0 deletions
37
backend/src/project-wall-notification/project-wall-notification.entity.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { Entity, Column, PrimaryGeneratedColumn, OneToOne, JoinColumn, ManyToOne, OneToMany } from 'typeorm'; | ||
import { Project } from '../project/project.entity'; | ||
import { User } from '../user/user.entity'; | ||
import { ProjectWallNotificationComment } from '../project-wall-notification-comment/comment.entity'; | ||
|
||
@Entity() | ||
export class ProjectWallNotification { | ||
@PrimaryGeneratedColumn({ unsigned: true }) | ||
id: number; | ||
|
||
@Column({ length: 200 }) | ||
author: string; | ||
|
||
@Column({ length: 200 }) | ||
title: string; | ||
|
||
@Column({ unsigned: true, type: 'int' }) | ||
projectId: number; | ||
|
||
@Column({ unsigned: true, type: 'int' }) | ||
userId: number; | ||
|
||
@ManyToOne(type => Project, project => project.wallNotifications, { onUpdate: 'CASCADE', onDelete: 'CASCADE' }) | ||
project: Project; | ||
|
||
@Column({ type: 'text', nullable: true }) | ||
postContent?: string | null; | ||
|
||
@Column({ type: 'datetime', default: () => 'CURRENT_TIMESTAMP' }) | ||
created: string; | ||
|
||
@OneToMany(type => ProjectWallNotificationComment, comment => comment.projectWallNotification) | ||
comments: ProjectWallNotificationComment[]; | ||
|
||
@ManyToOne(type => User, user => user.projectWallNotifications) | ||
user: User; | ||
} |
21 changes: 21 additions & 0 deletions
21
backend/src/project-wall-notification/project-wall-notification.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { TypeOrmModule } from '@nestjs/typeorm'; | ||
import { ProjectWallNotification } from './project-wall-notification.entity'; | ||
import { ProjectWallNotificationService } from './project-wall-notification.service'; | ||
import { ProjectWallNotificationCommentModule } from '../project-wall-notification-comment/project-wall-notification-comment.module'; | ||
|
||
@Module({ | ||
imports: [ | ||
TypeOrmModule.forFeature([ | ||
ProjectWallNotification | ||
]), | ||
ProjectWallNotificationCommentModule | ||
], | ||
providers: [ | ||
ProjectWallNotificationService | ||
], | ||
exports: [ | ||
ProjectWallNotificationService | ||
] | ||
}) | ||
export class ProjectWallNotificationModule { } |
Oops, something went wrong.