Skip to content

Commit 5a09a58

Browse files
committed
Improvements and new features
1 parent 2fc36a8 commit 5a09a58

File tree

8 files changed

+54
-20
lines changed

8 files changed

+54
-20
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Please keep in mind that we just develop the software and don't host the applica
1212

1313
All products are built on top of the **Aionic Core** application, since this is the place where all your data is managed and distributed. So for the usage of any other application, you have to use at least [Aionic Core](https://github.com/Aionic-Apps/aionic-core/).
1414

15+
Moreover we highly recommend [Aionic Manager](https://github.com/Aionic-Apps/aionic-manager/) which makes your data management much easier.
16+
1517
Some of the technologies we trust: _Node.js, React, MySQL_
1618

1719
## Features

aionic.code-workspace

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
{
2-
"folders": [
3-
{
4-
"path": "."
5-
}
6-
],
7-
"settings": {
8-
"editor.formatOnPaste": true,
9-
"editor.formatOnSave": true,
10-
"editor.formatOnType": true
11-
}
2+
"folders": [
3+
{
4+
"path": "."
5+
}
6+
],
7+
"settings": {
8+
"editor.formatOnPaste": true,
9+
"editor.formatOnSave": true,
10+
"editor.formatOnType": true
11+
},
12+
"extensions": {
13+
"recommendations": ["ms-vscode.vscode-typescript-tslint-plugin", "esbenp.prettier-vscode"]
14+
}
1215
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"scripts": {
1212
"start": "node ./dist/index.js",
1313
"build": "rm -rf dist && tsc -p tsconfig.json && gulp copy && gulp merge",
14-
"watch": "nodemon --exec \"npm run build && npm run start\" --watch src --ext ts",
14+
"build:light": "rm -rf dist && tsc -p tsconfig.json",
15+
"watch": "nodemon --exec \"npm run build:light && npm run start\" --watch src --ext ts",
1516
"seed": "node db/index.js",
1617
"lint": "tslint -p tsconfig.json",
1718
"prettier": "prettier --config ./.prettierrc --write src/**/*.ts",

src/api/components/global/user/model.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {
22
Column,
33
CreateDateColumn,
44
Entity,
5+
JoinTable,
56
ManyToMany,
67
ManyToOne,
78
OneToMany,
@@ -83,4 +84,8 @@ export class User {
8384

8485
@ManyToMany((type) => Board, (board) => board.users)
8586
public boards: Board[];
87+
88+
@ManyToMany((type) => Task)
89+
@JoinTable()
90+
public tasksWatched: Task[];
8691
}

src/api/components/global/user/service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { CacheService } from '@services/cache';
66
import { User } from './model';
77

88
export class UserService {
9-
private readonly defaultRelations: string[] = ['userRole', 'assignee'];
9+
private readonly defaultRelations: string[] = ['userRole', 'assignee', 'tasksWatched'];
1010

1111
private readonly cacheService: CacheService = new CacheService();
1212

src/api/components/milestone/project/controller.ts

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { NextFunction, Request, Response } from 'express';
33

44
import { Project } from './model';
55
import { ProjectService } from './service';
6+
import { FindConditions, OrderByCondition } from 'typeorm';
67

78
export class ProjectController {
89
private readonly service: ProjectService = new ProjectService();
@@ -16,23 +17,29 @@ export class ProjectController {
1617
@bind
1718
public async readProjects(req: Request, res: Response, next: NextFunction): Promise<Response | void> {
1819
try {
19-
const { orderby, orderdir, limit } = req.query;
20+
const { completed, orderby, orderdir, limit } = req.query;
2021

21-
let order = {};
22-
let take: object = {};
22+
let where: FindConditions<Project> = {};
23+
let order: OrderByCondition = { completed: 'ASC' };
24+
let take: number = 0;
25+
26+
if (completed !== undefined && completed.length) {
27+
where = { ...where, completed: !!+completed };
28+
}
2329

2430
if (orderby || orderdir) {
25-
order = { order: { [orderby || 'id']: orderdir || 'ASC' } };
31+
order = { [orderby || 'completed']: orderdir || 'ASC' };
2632
}
2733

2834
if (limit) {
29-
take = { take: limit };
35+
take = limit;
3036
}
3137

3238
const projects: Project[] = await this.service.readProjects({
33-
relations: ['author', 'tasks', 'tasks.status'],
34-
...order,
35-
...take
39+
where,
40+
order,
41+
take,
42+
relations: ['author', 'tasks', 'tasks.status']
3643
});
3744

3845
return res.json({ status: res.statusCode, data: projects });

src/api/components/milestone/project/model.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ export class Project {
2424
})
2525
public title: string;
2626

27+
@Column({
28+
default: null,
29+
unique: true
30+
})
31+
public key: string;
32+
2733
@Column({
2834
default: null,
2935
type: 'text'
@@ -35,6 +41,11 @@ export class Project {
3541
})
3642
public completed: boolean;
3743

44+
@Column({
45+
default: false
46+
})
47+
public isClone: boolean;
48+
3849
@Column({
3950
default: null,
4051
type: 'datetime'

src/api/components/milestone/task/model.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ export class Task {
5959
})
6060
public completed: boolean;
6161

62+
@Column({
63+
default: false
64+
})
65+
public isClone: boolean;
66+
6267
@Column({
6368
default: null,
6469
type: 'datetime'

0 commit comments

Comments
 (0)