Skip to content
Merged

Dev #38

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
525cdd1
Merge branch 'mtb-49-ui-mangage-bots' of mtbgithub:nccasia/mezon-top-…
dungcoongphanchi Feb 20, 2025
228cf3c
mtb-38: create seed file and base logic for GET bot
gaubacuc56 Feb 20, 2025
babb85f
mtb-47: ui publish new bot
dungcoongphanchi Feb 21, 2025
7a7b9f0
mtb-47: update link types default values
dungcoongphanchi Feb 21, 2025
9a039c9
mtb-47: update set up script gen-api
dungcoongphanchi Feb 21, 2025
7869544
mtb-47: update endpoint api
dungcoongphanchi Feb 21, 2025
5596b6f
mtb-47: set up light-dark mode
dungcoongphanchi Feb 21, 2025
06a80e5
remove depend on
hoangduy0610 Feb 22, 2025
77fb417
mtb-38: complete get bots api for home and detail screen
gaubacuc56 Feb 23, 2025
47dea04
Merge branch 'dev' of https://github.com/nccasia/mezon-top-board into…
gaubacuc56 Feb 23, 2025
1e96bfa
mtb-38: change method to globay filter with ID
gaubacuc56 Feb 23, 2025
4b2528f
mtb-38: format
gaubacuc56 Feb 23, 2025
2e5e562
Merge branch 'dev' of mtbgithub:nccasia/mezon-top-board into mtb-47-u…
dungcoongphanchi Feb 24, 2025
ec7a2f1
mtb-47: delete ETag
dungcoongphanchi Feb 24, 2025
af117d2
mtb-38: handle feedback
gaubacuc56 Feb 24, 2025
7ab4e62
mtb-38: format
gaubacuc56 Feb 24, 2025
f94be0b
Merge pull request #9 from nccasia/feature/mtb-38
hoangduy0610 Feb 24, 2025
0f34e4a
Merge pull request #11 from nccasia/mtb-47-ui-publish-new-bot
hoangduy0610 Feb 24, 2025
846968b
mtb-38: change create and update link logic
gaubacuc56 Feb 24, 2025
ef4ad0f
api get all tag
dungcoongphanchi Feb 24, 2025
cc23b7e
Merge pull request #13 from nccasia/feature/mtb-38-refactor-link-logic
ncc-duy-nguyen Feb 24, 2025
6b681a3
Update docker
hoangduy0610 Feb 24, 2025
0418b23
Merge branch 'dev' of github.com:nccasia/mezon-top-board into dev
hoangduy0610 Feb 24, 2025
61c6ac2
mtb-40: Integrate Listing bot Pagination with API
dungcoongphanchi Feb 24, 2025
b6681a1
MTB-56 test CI/CD
hoangduy0610 Feb 25, 2025
283e9ba
Merge pull request #14 from nccasia/MTB-56
hoangduy0610 Feb 25, 2025
99d4b15
MTB-56 update CICD pipeline dev
hoangduy0610 Feb 25, 2025
b85006a
MTB-56 update CICD dev pipeline
hoangduy0610 Feb 25, 2025
6c5ad86
MTB-56 update CICD pipeline
hoangduy0610 Feb 25, 2025
de1f1c4
MTB-56 update CICD pipeline
hoangduy0610 Feb 25, 2025
6abb907
MTB-56 use environment for CICD
hoangduy0610 Feb 25, 2025
a6fd50f
Merge branch 'dev' of mtbgithub:nccasia/mezon-top-board into mtb-46
dungcoongphanchi Feb 25, 2025
7b31f32
mtb-42: integrate Listing bot Filter with API
dungcoongphanchi Feb 25, 2025
8f2e5c9
mtb-46: optimize code
dungcoongphanchi Feb 26, 2025
c325f57
MTB-18 - User authorization
minhnguyenhoangkhanh Feb 27, 2025
7d65380
Merge pull request #15 from nccasia/mtb-46
hoangduy0610 Feb 27, 2025
461dd6a
Merge branch 'dev' of mtb:nccasia/mezon-top-board into MTB-18-User-au…
minhnguyenhoangkhanh Feb 27, 2025
e3141b5
MTB-18 - Additional variables into env.example, use constant for erro…
minhnguyenhoangkhanh Feb 27, 2025
368ebef
MTB-18 - update env example
minhnguyenhoangkhanh Feb 27, 2025
b1e0308
Merge pull request #16 from nccasia/MTB-18-User-authorization
hoangduy0610 Feb 27, 2025
609ab92
Update docker for env frontend & authorization
hoangduy0610 Feb 27, 2025
f4185a1
feat: MTB-57-Admin-UI
yIeqsoft Feb 27, 2025
de2cd49
docker certbot
hoangduy0610 Feb 27, 2025
9e115cb
docker for ssl
hoangduy0610 Feb 27, 2025
460159b
Merge pull request #18 from nccasia/docker-certbot
hoangduy0610 Feb 27, 2025
e801704
update docker
hoangduy0610 Feb 27, 2025
b7039fb
Merge branch 'dev' of https://github.com/nccasia/mezon-top-board into…
yIeqsoft Feb 27, 2025
143b830
feat: MTB-57-List-All-Apps
yIeqsoft Feb 27, 2025
0b500ec
MTB-62 - Remove cls service out of app module
minhnguyenhoangkhanh Feb 28, 2025
db1dee8
Merge pull request #19 from nccasia/MTB-62
hoangduy0610 Feb 28, 2025
69d116d
feat: MTB-57-Apps-CRUD
yIeqsoft Feb 28, 2025
2c558a3
Merge branch 'dev' of github.com:nccasia/mezon-top-board into MTB-57-…
hoangduy0610 Mar 1, 2025
d63f0d5
refactor 1
hoangduy0610 Mar 1, 2025
356a156
clean
hoangduy0610 Mar 1, 2025
3238544
fix bug
hoangduy0610 Mar 1, 2025
a23a9ce
Merge pull request #17 from nccasia/MTB-57-Admin-UI
hoangduy0610 Mar 1, 2025
64529f5
feat: fix code style
gaubacuc56 Mar 2, 2025
6378d69
update migration
hoangduy0610 Mar 2, 2025
4280ac8
Merge pull request #20 from nccasia/hotfix/enhance-code-style
hoangduy0610 Mar 2, 2025
89a4337
mtb-61: CRUD app review
gaubacuc56 Mar 2, 2025
7ea2b53
Merge pull request #21 from nccasia/feature/mtb-61
hoangduy0610 Mar 3, 2025
b4bd25c
mtb-60: rud api
gaubacuc56 Mar 3, 2025
fc9d601
mtb-60: add me and self update
gaubacuc56 Mar 3, 2025
c11ad2a
Merge pull request #22 from nccasia/feature/mtb-60
hoangduy0610 Mar 3, 2025
57844e0
update generate state code from BE side
hoangduy0610 Mar 3, 2025
c6faee8
feat: Remove the caching feature of RTK Query
yIeqsoft Mar 4, 2025
7829eec
MTB-65 review app
hoangduy0610 Mar 4, 2025
41eb854
MTB-65 fix docker
hoangduy0610 Mar 4, 2025
6a63697
Merge pull request #24 from nccasia/MTB-65
ncc-duy-nguyen Mar 4, 2025
fa75ecb
mtb-48 & mtb-50: Integrate UI publish bot with API and manage bots wi…
dungcoongphanchi Mar 4, 2025
7a3b724
mtb-48 & mtb-50: updated code and rename file
dungcoongphanchi Mar 4, 2025
b0aee9f
update mapper
dungcoongphanchi Mar 4, 2025
8bf5ecf
Merge pull request #25 from nccasia/mtb-48-and-mtb-50
ncc-duy-nguyen Mar 4, 2025
602c428
MTB-66
hoangduy0610 Mar 4, 2025
591d0b3
update
hoangduy0610 Mar 4, 2025
eb06c79
Merge pull request #26 from nccasia/MTB-66
ncc-duy-nguyen Mar 4, 2025
c8f1de0
update docker
hoangduy0610 Mar 4, 2025
1d1d826
update endpoint
hoangduy0610 Mar 5, 2025
b5d2528
mtb-70: update endpoint my-app
dungcoongphanchi Mar 5, 2025
8c12e97
feat: use Redux to update UI
yIeqsoft Mar 5, 2025
0f012a2
update
hoangduy0610 Mar 5, 2025
f89c5e0
Merge branch 'dev' of mtbgithub:nccasia/mezon-top-board into mtb-70
dungcoongphanchi Mar 5, 2025
6b712c1
refactor: remove unnecessary comments and "!" (non-null assertion ope…
yIeqsoft Mar 5, 2025
e076330
mtb-70: integrate api upload image
dungcoongphanchi Mar 5, 2025
2d7c18d
Merge branch 'dev' into MTB-57-Admin-UI
yIeqsoft Mar 5, 2025
aed2adc
mtb-70: update get url image
dungcoongphanchi Mar 5, 2025
3447b5d
Merge pull request #23 from nccasia/MTB-57-Admin-UI
hoangduy0610 Mar 5, 2025
8a2bdcc
Merge branch 'dev' of github.com:nccasia/mezon-top-board into mtb-70
hoangduy0610 Mar 5, 2025
02cf22c
Merge pull request #27 from nccasia/mtb-70
hoangduy0610 Mar 5, 2025
ca63d96
update proto1
hoangduy0610 Mar 5, 2025
fa9de0d
update footer
hoangduy0610 Mar 5, 2025
aae5ff5
update search api
hoangduy0610 Mar 6, 2025
1e6253a
update help page
yIeqsoft Mar 6, 2025
4bdfefd
feat: table list user
yIeqsoft Mar 6, 2025
296b9bf
refactor: useMemo and create components
yIeqsoft Mar 6, 2025
74c373d
MTB-26: Admin – Review and Moderate Reviews
dungcoongphanchi Mar 6, 2025
d3cd5c7
Merge pull request #34 from nccasia/mtb-26
hoangduy0610 Mar 7, 2025
1c89af0
Merge branch 'dev' into MTB-71-Table-list-user
yIeqsoft Mar 7, 2025
2ba486b
MTB-68: Update Terms Page
TieuCuongKin Mar 7, 2025
7ec4b76
MTB-67: Update About Page
TieuCuongKin Mar 6, 2025
5ba1bf1
Merge pull request #33 from nccasia/MTB-71-Table-list-user
hoangduy0610 Mar 7, 2025
03c3497
Merge pull request #29 from nccasia/MTB-69-Update-Help-page
hoangduy0610 Mar 7, 2025
5f704e6
Merge pull request #35 from nccasia/MTB-68-Terms-Page
hoangduy0610 Mar 7, 2025
253bd43
Merge pull request #31 from nccasia/MTB-67-About-Page
hoangduy0610 Mar 7, 2025
73c7334
release 1
hoangduy0610 Mar 7, 2025
5f41199
mtb-63: crud tag
gaubacuc56 Mar 7, 2025
581e547
mtb-63: clean up
gaubacuc56 Mar 7, 2025
6c499a4
update minor ui
hoangduy0610 Mar 7, 2025
5fba733
mtb-73: init code
gaubacuc56 Mar 9, 2025
070c94a
Merge pull request #36 from nccasia/feature/mtb-63
hoangduy0610 Mar 10, 2025
27966e0
Merge branch 'dev' of https://github.com/nccasia/mezon-top-board into…
gaubacuc56 Mar 10, 2025
9814e3f
Merge pull request #37 from nccasia/feature/mtb-73
gaubacuc56 Mar 10, 2025
cc21528
update
hoangduy0610 Mar 11, 2025
de202ca
Merge branch 'dev' of github.com:nccasia/mezon-top-board into dev
hoangduy0610 Mar 11, 2025
2d51a6d
update pipeline prod
hoangduy0610 Mar 11, 2025
50dc897
remove pipeline master
hoangduy0610 Mar 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,16 @@ POSTGRES_PASSWORD=postgres
POSTGRES_DB=mtb
POSTGRES_SCHEMA=public

OAUTH2_CLIENT_ID=xxxx
OAUTH2_CLIENT_SECRET=xxxxxx
OAUTH2_REDIRECT_URI=http://localhost:3000/callbacks
OAUTH2_API_URL=https://oauth2.mezon.ai

JWT_ACCESS_TOKEN_SECRET=1234567890
JWT_REFRESH_TOKEN_SECRET=abcd1234
JWT_ACCESS_TOKEN_EXPIRES_IN_MINUTES=60 # 60 minutes
JWT_REFRESH_TOKEN_EXPIRES_IN_MINUTES=10080 # 10080 minutes (7 days)
UPLOAD_RELATIVE_DIR=uploads

# FRONTEND
REACT_APP_BACKEND_URL=http://localhost:8778
27 changes: 27 additions & 0 deletions .github/workflows/dev_server.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Deploy to Development Server

on:
push:
branches:
- dev

jobs:
deploy:
runs-on: top-dev
environment: development
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: SSH into server and deploy application
uses: appleboy/ssh-action@v1.2.1
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USER }}
password: ${{ secrets.SERVER_PASSWORD }}
port: 22
script: |
cd ~/mezon-top-board
git pull origin dev
./docker-up.sh --build --dev --core
docker system prune -f
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
.env
.env
certbot/*
!certbot/options-ssl-nginx.conf
!certbot/ssl-dhparams.pem
3 changes: 2 additions & 1 deletion backend/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
npm-debug.log
dist
dist
.env.local
3 changes: 3 additions & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,6 @@ pids

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

uploads/*
!uploads/.gitkeep
11 changes: 11 additions & 0 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"db:generate": "sh scripts/migration.sh gen local",
"db:run": "yarn typeorm migration:run",
"db:revert": "yarn typeorm migration:revert",
"db:seed": "yarn build && node dist/libs/repository/seed.js",
"db:generate:prod": "sh scripts/migration.sh gen prod",
"db:run:prod": "cross-env ENV=prod yarn typeorm migration:run",
"db:revert:prod": "cross-env ENV=prod yarn typeorm migration:revert"
Expand All @@ -30,13 +31,21 @@
"@nestjs/common": "^10.0.0",
"@nestjs/config": "^4.0.0",
"@nestjs/core": "^10.0.0",
"@nestjs/jwt": "^11.0.0",
"@nestjs/passport": "^11.0.5",
"@nestjs/platform-express": "^10.0.0",
"@nestjs/swagger": "^11.0.3",
"@nestjs/typeorm": "^11.0.0",
"axios": "^1.8.1",
"bcrypt": "^5.1.1",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.1",
"dotenv": "^16.4.7",
"moment": "^2.30.1",
"multer": "^1.4.5-lts.1",
"nestjs-cls": "^5.2.0",
"passport": "^0.7.0",
"passport-jwt": "^4.0.1",
"pg": "^8.13.1",
"reflect-metadata": "^0.2.0",
"rxjs": "^7.8.1",
Expand All @@ -46,8 +55,10 @@
"@nestjs/cli": "^10.0.0",
"@nestjs/schematics": "^10.0.0",
"@nestjs/testing": "^10.0.0",
"@types/bcrypt": "^5.0.2",
"@types/express": "^4.17.17",
"@types/jest": "^29.5.2",
"@types/multer": "^1.4.12",
"@types/node": "^20.3.1",
"@types/supertest": "^6.0.0",
"@typescript-eslint/eslint-plugin": "^8.0.0",
Expand Down
16 changes: 16 additions & 0 deletions backend/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,16 @@ import { TypeOrmModule } from "@nestjs/typeorm";
import { dataSourceOption } from "@config/data-source.config";
import config, { envFilePath } from "@config/env.config";

import { AuthModule } from "@features/auth/auth.module";
import { LinkTypeModule } from "@features/linkType/linkType.module";
import { MediaModule } from "@features/media/media.module";
import { MezonAppModule } from "@features/mezon-app/mezon-app.module";
import { RatingModule } from "@features/rating/rating.module";
import { ReviewHistoryModule } from "@features/review-history/review-history.module";
import { TagModule } from "@features/tag/tag.module";
import { UserModule } from "@features/user/user.module";

import { GuardModule } from "@libs/guard/guard.module";
import { LoggerModule } from "@libs/logger";

@Module({
Expand All @@ -19,6 +27,14 @@ import { LoggerModule } from "@libs/logger";
TypeOrmModule.forRoot(dataSourceOption),
LoggerModule,
MediaModule,
MezonAppModule,
AuthModule,
GuardModule,
TagModule,
ReviewHistoryModule,
UserModule,
LinkTypeModule,
RatingModule
],
controllers: [],
providers: [],
Expand Down
11 changes: 10 additions & 1 deletion backend/src/config/env.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,20 @@ export const envFilePath = `.env.${ENV ?? "local"}`;
dotenv.config({ path: envFilePath });

export default () => ({
PORT: process.env.PORT || 8000,
PORT: process.env.PORT || 8123,
DB_NAME: process.env.POSTGRES_DB || "",
DB_PORT: process.env.POSTGRES_PORT || 5432,
DB_HOST: process.env.POSTGRES_HOST || "",
DB_USERNAME: process.env.POSTGRES_USERNAME || "",
DB_PASSWORD: process.env.POSTGRES_PASSWORD || "",
DB_SCHEMA: process.env.POSTGRES_SCHEMA || "public",
OAUTH2_CLIENT_ID: process.env.OAUTH2_CLIENT_ID || "",
OAUTH2_CLIENT_SECRET: process.env.OAUTH2_CLIENT_SECRET || "",
OAUTH2_REDIRECT_URI: process.env.OAUTH2_REDIRECT_URI || "",
OAUTH2_API_URL: process.env.OAUTH2_API_URL || "",
JWT_ACCESS_TOKEN_SECRET: process.env.JWT_ACCESS_TOKEN_SECRET || "",
JWT_REFRESH_TOKEN_SECRET: process.env.JWT_REFRESH_TOKEN_SECRET || "",
JWT_ACCESS_TOKEN_EXPIRES_IN_MINUTES: process.env.JWT_ACCESS_TOKEN_EXPIRES_IN_MINUTES || 60,
JWT_REFRESH_TOKEN_EXPIRES_IN_MINUTES: process.env.JWT_REFRESH_TOKEN_EXPIRES_IN_MINUTES || 10080,
UPLOAD_RELATIVE_DIR: process.env.UPLOAD_RELATIVE_DIR || "uploads",
});
44 changes: 44 additions & 0 deletions backend/src/config/files.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { imageMimeTypes, videoMimeTypes } from "@domain/common/constants/fileMimeTypes";
import { createUploadPath, generateFilename, isMimeTypeValid } from "@libs/utils/file";
import { INestApplication } from "@nestjs/common";
import * as express from 'express';
import { existsSync, mkdirSync } from "fs";
import { diskStorage } from "multer";
import { join } from "path";
import envConfig from "./env.config";

const uploadDir = join(process.cwd(), envConfig().UPLOAD_RELATIVE_DIR);

const multerConfig = {
storage: diskStorage({
destination: (req, file, cb) => {
const uploadPath = createUploadPath(uploadDir);
if (!existsSync(uploadPath)) {
mkdirSync(uploadPath, { recursive: true });
}
cb(null, uploadPath);
},
filename: (req, file, cb) => {
cb(null, generateFilename(file));
},
}),
fileFilter: (req, file, cb) => {
if (isMimeTypeValid(file.mimetype, imageMimeTypes) || isMimeTypeValid(file.mimetype, videoMimeTypes)) {
cb(null, true);
} else {
cb(new Error('Only images and video are allowed...'), false);
}
},
};

const configStaticFiles = (app: INestApplication) => {
if (!existsSync(uploadDir)) {
mkdirSync(uploadDir);
}
app.use('/api/uploads', express.static(uploadDir));
};

export {
configStaticFiles, multerConfig, uploadDir
};

5 changes: 4 additions & 1 deletion backend/src/config/swagger.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ export const configSwagger = (app: INestApplication) => {

const document = SwaggerModule.createDocument(app, config);
SwaggerModule.setup("api", app, document, {
swaggerOptions: { persistAuthorizationL: true },
swaggerOptions: { persistAuthorizationL: true, url: '/api/openApi.json', },
});
app.getHttpAdapter().get('/api/openApi.json', (req, res) => {
res.json(document);
});
};
28 changes: 28 additions & 0 deletions backend/src/domain/common/constants/fileMimeTypes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const imageMimeTypes = [
'image/jpeg',
'image/png',
'image/jpg',
'image/gif',
'image/webp',
'image/svg+xml',
'image/x-icon',
'image/vnd.microsoft.icon',
'image/vnd.wap.wbmp',
'image/bmp',
'image/tiff'
];

const videoMimeTypes = [
'video/mp4',
'video/x-msvideo',
'video/x-ms-wmv',
'video/mpeg',
'video/quicktime',
'video/x-flv',
'video/x-ms-wmv'
];

export {
imageMimeTypes,
videoMimeTypes,
}
4 changes: 2 additions & 2 deletions backend/src/domain/common/enum/role.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export enum Role {
ADMIN,
DEVELOPER
ADMIN = "ADMIN",
DEVELOPER = "DEVELOPER",
}
15 changes: 9 additions & 6 deletions backend/src/domain/entities/schema/app.entity.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import { Column, Entity, JoinTable, ManyToMany, OneToMany, Unique } from "typeorm";
import { Column, Entity, JoinColumn, JoinTable, ManyToMany, ManyToOne, OneToMany, Unique } from "typeorm";

import { AppStatus } from "@domain/common/enum/appStatus";
import { Link, AppReviewHistory, Rating, Tag } from "@domain/entities";
import { Link, AppReviewHistory, Rating, Tag, User } from "@domain/entities";

import { BaseSoftDelete } from "../base";

@Entity()
@Unique(["name"])
export class App extends BaseSoftDelete {
@Column()
public name: string;

@Column()
public ownerId: string;

@Column({
type: "enum",
enum: AppStatus,
Expand All @@ -36,9 +38,6 @@ export class App extends BaseSoftDelete {
@Column({ nullable: true })
public featuredImage: string;

@Column()
public ownerId: string;

@Column({ nullable: true })
public supportUrl: string;

Expand All @@ -58,4 +57,8 @@ export class App extends BaseSoftDelete {

@OneToMany(() => Rating, (rating) => rating.app)
ratings: Rating[];

@ManyToOne(() => User, (user) => user.apps, { onDelete: "CASCADE" })
@JoinColumn({ name: "ownerId" })
owner: User;
}
16 changes: 12 additions & 4 deletions backend/src/domain/entities/schema/appReviewHistory.entity.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Entity, Column, ManyToOne } from "typeorm";
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";

import { App } from "@domain/entities";
import { App, User } from "@domain/entities";

import { BaseSoftDelete } from "../base";

Expand All @@ -9,15 +9,23 @@ export class AppReviewHistory extends BaseSoftDelete {
@Column()
public appId: string;

@Column()
public reviewer: string;
@Column({ default: false })
public isApproved: boolean;

@Column()
public reviewerId: string;

@Column({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
public reviewedAt: Date;

@Column()
public remark: string;

@ManyToOne(() => App, (app) => app.id, { onDelete: "CASCADE" })
@JoinColumn({ name: "appId" })
app: App;

@ManyToOne(() => User, (user) => user.id, { onDelete: "CASCADE" })
@JoinColumn({ name: "reviewerId" })
reviewer: User;
}
15 changes: 11 additions & 4 deletions backend/src/domain/entities/schema/link.entity.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Entity, Column, ManyToOne, ManyToMany } from "typeorm";
import { Entity, Column, ManyToOne, ManyToMany, JoinColumn } from "typeorm";

import { App, LinkType, Developer } from "@domain/entities";
import { App, LinkType, User } from "@domain/entities";

import { BaseSoftDelete } from "../base";

Expand All @@ -9,16 +9,23 @@ export class Link extends BaseSoftDelete {
@Column()
public url: string;

@Column()
public ownerId: string;

@Column({ default: false })
public showOnProfile: boolean;

@Column()
public linkTypeId: string;

@ManyToOne(() => LinkType, (linkType) => linkType.links)
@JoinColumn({ name: "linkTypeId" })
public type: LinkType;

@ManyToMany(() => App, (app) => app.socialLinks)
public apps: App[];

@ManyToMany(() => Developer, (dev) => dev.socialLinks)
public devs: Developer[];
@ManyToOne(() => User, (user) => user.links)
public owner: User;
}

19 changes: 15 additions & 4 deletions backend/src/domain/entities/schema/media.entity.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
import { Entity, Column, Unique } from "typeorm";

import { Column, Entity, ManyToOne } from "typeorm";
import { BaseSoftDelete } from "../base";
import { User } from "./user.entity";

@Entity()
@Unique(["name"])
export class Media extends BaseSoftDelete {
@Column()
public name: string;
public fileName: string;

@Column({ nullable: true })
public mimeType: string;

@Column({ nullable: true })
public filePath: string;

@Column({ nullable: true })
public ownerId: string;

@ManyToOne(() => User, (user) => user.medias)
public owner: User;
}
Loading