@things-factory/operato-codelingua 8.0.5 → 9.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.dockerignore +24 -6
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +48 -48
- package/client/bootstrap.ts +0 -206
- package/client/icons/menu-icons.ts +0 -91
- package/client/index.ts +0 -0
- package/client/pages/git-project/git-project-list-page.ts +0 -427
- package/client/route.ts +0 -8
- package/client/themes/dark.css +0 -51
- package/client/themes/light.css +0 -51
- package/client/tsconfig.json +0 -12
- package/client/viewparts/menu-tools.ts +0 -170
- package/client/viewparts/user-circle.ts +0 -24
- package/installer/config.production.js +0 -40
- package/installer/docker-compose.yml +0 -42
- package/installer/install.sh +0 -54
- package/installer/migrate.sh +0 -1
- package/installer/start.sh +0 -18
- package/installer/stop.sh +0 -1
- package/installer/upgrade.sh +0 -1
- package/server/controllers/github-controller.ts +0 -98
- package/server/controllers/index.ts +0 -0
- package/server/index.ts +0 -7
- package/server/middlewares/index.ts +0 -3
- package/server/migrations/index.ts +0 -9
- package/server/routers/github-webhook-router.ts +0 -45
- package/server/routes.ts +0 -30
- package/server/service/git-project/git-project-mutation.ts +0 -179
- package/server/service/git-project/git-project-query.ts +0 -48
- package/server/service/git-project/git-project-type.ts +0 -76
- package/server/service/git-project/git-project.ts +0 -114
- package/server/service/git-project/index.ts +0 -7
- package/server/service/index.ts +0 -21
- package/server/tsconfig.json +0 -9
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import { css, html, LitElement } from 'lit'
|
|
2
|
-
import { customElement, property, query } from 'lit/decorators.js'
|
|
3
|
-
|
|
4
|
-
import { connect } from 'pwa-helpers'
|
|
5
|
-
|
|
6
|
-
import { store } from '@operato/shell'
|
|
7
|
-
|
|
8
|
-
import { ICONS_PROGRESS, ICONS_COMPLETED, ICONS_STATUS, ICONS_OPERATING, ICONS_SETTING } from '../icons/menu-icons'
|
|
9
|
-
|
|
10
|
-
@customElement('menu-tools')
|
|
11
|
-
export class MenuTools extends connect(store)(LitElement) {
|
|
12
|
-
static styles = [
|
|
13
|
-
css`
|
|
14
|
-
:host {
|
|
15
|
-
display: flex;
|
|
16
|
-
background-color: var(--secondary-color);
|
|
17
|
-
|
|
18
|
-
/* for narrow mode */
|
|
19
|
-
flex-direction: column;
|
|
20
|
-
width: 100%;
|
|
21
|
-
--menu-tools-color: rgba(255, 255, 255, 0.9);
|
|
22
|
-
--menu-tools-active-color: rgba(107, 178, 249, 1);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
:host([width='WIDE']) {
|
|
26
|
-
/* for wide mode */
|
|
27
|
-
flex-direction: row;
|
|
28
|
-
width: initial;
|
|
29
|
-
height: 100%;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
ul {
|
|
33
|
-
display: flex;
|
|
34
|
-
flex-direction: row;
|
|
35
|
-
|
|
36
|
-
margin: auto;
|
|
37
|
-
padding: 0;
|
|
38
|
-
list-style: none;
|
|
39
|
-
height: 100%;
|
|
40
|
-
overflow: none;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
:host([width='NARROW']) ul {
|
|
44
|
-
width: 100%;
|
|
45
|
-
justify-content: space-around;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
:host([width='WIDE']) ul {
|
|
49
|
-
flex-direction: column;
|
|
50
|
-
}
|
|
51
|
-
:host([width='NARROW']) li {
|
|
52
|
-
flex: 1;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
:host([width='WIDE']) li {
|
|
56
|
-
border-top: 1px solid rgba(255, 255, 255, 0.1);
|
|
57
|
-
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
a {
|
|
61
|
-
display: flex;
|
|
62
|
-
flex-direction: column;
|
|
63
|
-
padding: 5px 0px;
|
|
64
|
-
opacity: 0.7;
|
|
65
|
-
align-items: center;
|
|
66
|
-
text-align: center;
|
|
67
|
-
text-decoration: none;
|
|
68
|
-
text-transform: capitalize;
|
|
69
|
-
color: var(--menu-tools-color);
|
|
70
|
-
border-left: 2px solid transparent;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
a[active] {
|
|
74
|
-
opacity: 1;
|
|
75
|
-
color: var(--menu-tools-active-color);
|
|
76
|
-
font-weight: bold;
|
|
77
|
-
background-color: rgba(0, 0, 0, 0.15);
|
|
78
|
-
border-left: 2px solid var(--menu-tools-active-color);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
:host([width='NARROW']) a {
|
|
82
|
-
padding: 0px 0px 5px 0px;
|
|
83
|
-
opacity: 0.8;
|
|
84
|
-
color: var(--menu-tools-color);
|
|
85
|
-
border-left: none;
|
|
86
|
-
border-top: 2px solid transparent;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
:host([width='NARROW']) a[active] {
|
|
90
|
-
opacity: 1;
|
|
91
|
-
color: var(--menu-tools-active-color);
|
|
92
|
-
font-weight: bold;
|
|
93
|
-
background-color: rgba(0, 0, 0, 0.15);
|
|
94
|
-
border-left: none;
|
|
95
|
-
border-top: 2px solid var(--menu-tools-active-color);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
img {
|
|
99
|
-
display: block;
|
|
100
|
-
width: 35px;
|
|
101
|
-
padding: 5px 10px 0px 10px;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
:host([width='NARROW']) img {
|
|
105
|
-
padding: 0;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
div {
|
|
109
|
-
font-size: 0.6em;
|
|
110
|
-
}
|
|
111
|
-
`
|
|
112
|
-
]
|
|
113
|
-
|
|
114
|
-
@property({ type: String }) page?: string
|
|
115
|
-
@property({ type: String, reflect: true }) width?: string
|
|
116
|
-
|
|
117
|
-
private menus: { name: string; path: string; icons: string[] }[] = []
|
|
118
|
-
|
|
119
|
-
render() {
|
|
120
|
-
this.menus = [
|
|
121
|
-
{
|
|
122
|
-
name: '진행중',
|
|
123
|
-
path: 'git-project-list',
|
|
124
|
-
icons: ICONS_PROGRESS
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
name: '완료',
|
|
128
|
-
path: 'project-completed-list',
|
|
129
|
-
icons: ICONS_COMPLETED
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
name: '현황',
|
|
133
|
-
path: 'dssp-status',
|
|
134
|
-
icons: ICONS_STATUS
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
name: '공정표',
|
|
138
|
-
path: 'project-schedule-list',
|
|
139
|
-
icons: ICONS_OPERATING
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
name: '셋팅',
|
|
143
|
-
path: 'project-setting-list',
|
|
144
|
-
icons: ICONS_SETTING
|
|
145
|
-
}
|
|
146
|
-
]
|
|
147
|
-
|
|
148
|
-
var page = this.page || ''
|
|
149
|
-
|
|
150
|
-
return html`
|
|
151
|
-
<ul>
|
|
152
|
-
${this.menus.map(
|
|
153
|
-
menu => html`
|
|
154
|
-
<li>
|
|
155
|
-
<a href=${menu.path} ?active=${!!~page.indexOf(menu.path)}>
|
|
156
|
-
<img src=${!!~page.indexOf(menu.path) ? menu.icons[1] : menu.icons[0]} />
|
|
157
|
-
<div>${menu.name}</div>
|
|
158
|
-
</a>
|
|
159
|
-
</li>
|
|
160
|
-
`
|
|
161
|
-
)}
|
|
162
|
-
</ul>
|
|
163
|
-
`
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
stateChanged(state) {
|
|
167
|
-
this.page = state.route.page
|
|
168
|
-
this.width = state.layout.width
|
|
169
|
-
}
|
|
170
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { LitElement, html, css } from 'lit'
|
|
2
|
-
import { customElement } from 'lit/decorators.js'
|
|
3
|
-
|
|
4
|
-
const userIcon = new URL('../../assets/images/user.png', import.meta.url).href
|
|
5
|
-
|
|
6
|
-
@customElement('user-circle')
|
|
7
|
-
export class UserCircle extends LitElement {
|
|
8
|
-
static styles = [
|
|
9
|
-
css`
|
|
10
|
-
img {
|
|
11
|
-
display: block;
|
|
12
|
-
width: 36px;
|
|
13
|
-
height: 36px;
|
|
14
|
-
border-radius: 50%;
|
|
15
|
-
|
|
16
|
-
object-fit: cover;
|
|
17
|
-
}
|
|
18
|
-
`
|
|
19
|
-
]
|
|
20
|
-
|
|
21
|
-
render() {
|
|
22
|
-
return html` <img src=${userIcon} class="user" /> `
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
SECRET: '0xD58F835B69D207A76CC5F84a70a1D0d4C79dAC95', // should be changed
|
|
3
|
-
email: {
|
|
4
|
-
host: 'smtp.office365.com', // your sender-email smtp host
|
|
5
|
-
port: 587, // smtp server port
|
|
6
|
-
secure: false, // true for 465, false for other ports
|
|
7
|
-
auth: {
|
|
8
|
-
user: 'your sender-email',
|
|
9
|
-
pass: 'your sender-email password' // generated ethereal password
|
|
10
|
-
},
|
|
11
|
-
secureConnection: false,
|
|
12
|
-
tls: {
|
|
13
|
-
ciphers: 'SSLv3'
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
logger: {
|
|
17
|
-
file: {
|
|
18
|
-
filename: 'logs/application-%DATE%.log',
|
|
19
|
-
datePattern: 'YYYY-MM-DD-HH',
|
|
20
|
-
zippedArchive: false,
|
|
21
|
-
maxSize: '20m',
|
|
22
|
-
maxFiles: '2d',
|
|
23
|
-
level: 'info'
|
|
24
|
-
},
|
|
25
|
-
console: {
|
|
26
|
-
level: 'silly'
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
ormconfig: {
|
|
30
|
-
name: 'default',
|
|
31
|
-
type: 'postgres',
|
|
32
|
-
host: 'postgres',
|
|
33
|
-
port: 5432,
|
|
34
|
-
database: 'postgres',
|
|
35
|
-
username: 'postgres',
|
|
36
|
-
password: 'abcd1234',
|
|
37
|
-
synchronize: true,
|
|
38
|
-
logging: true
|
|
39
|
-
}
|
|
40
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
version: '3'
|
|
2
|
-
services:
|
|
3
|
-
nginx:
|
|
4
|
-
image: hatiolab/operato-nginx:latest
|
|
5
|
-
ports:
|
|
6
|
-
- ${HostPort}:80
|
|
7
|
-
depends_on:
|
|
8
|
-
- app
|
|
9
|
-
app:
|
|
10
|
-
build: .
|
|
11
|
-
container_name: operato-codelingua
|
|
12
|
-
image: hatiolab/operato-codelingua:latest
|
|
13
|
-
privileged: true
|
|
14
|
-
volumes:
|
|
15
|
-
- ./logs:/app/logs
|
|
16
|
-
- ./config.production.js:/app/config.production.js
|
|
17
|
-
ports:
|
|
18
|
-
- 4000:3000
|
|
19
|
-
depends_on:
|
|
20
|
-
- postgres
|
|
21
|
-
- mosquitto
|
|
22
|
-
logging:
|
|
23
|
-
driver: 'json-file'
|
|
24
|
-
options:
|
|
25
|
-
max-size: '100m'
|
|
26
|
-
max-file: '3'
|
|
27
|
-
postgres:
|
|
28
|
-
image: postgres:13.2
|
|
29
|
-
container_name: db-operato-codelingua
|
|
30
|
-
environment:
|
|
31
|
-
POSTGRES_PASSWORD: abcd1234
|
|
32
|
-
POSTGRES_USER: postgres
|
|
33
|
-
PGDATA: /var/lib/postgresql/data/pgdata
|
|
34
|
-
volumes:
|
|
35
|
-
- ./postgres_data:/var/lib/postgresql/data/pgdata
|
|
36
|
-
ports:
|
|
37
|
-
- '55432:5432'
|
|
38
|
-
mosquitto:
|
|
39
|
-
image: eclipse-mosquitto:latest
|
|
40
|
-
ports:
|
|
41
|
-
- 1883:1883
|
|
42
|
-
- 9001:9001
|
package/installer/install.sh
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
if [ -f "config.production.js" ] ; then
|
|
2
|
-
echo "config.production.js exist"
|
|
3
|
-
else
|
|
4
|
-
echo "config.production.js create"
|
|
5
|
-
curl -O https://raw.githubusercontent.com/things-factory/things-factory/master/packages/operato-codelingua/installer/config.production.js
|
|
6
|
-
fi
|
|
7
|
-
|
|
8
|
-
if [ -f "start.sh" ] ; then
|
|
9
|
-
echo "start.sh exist"
|
|
10
|
-
else
|
|
11
|
-
echo "start.sh create"
|
|
12
|
-
curl -O https://raw.githubusercontent.com/things-factory/things-factory/master/packages/operato-codelingua/installer/start.sh
|
|
13
|
-
fi
|
|
14
|
-
|
|
15
|
-
if [ -f "stop.sh" ] ; then
|
|
16
|
-
echo "stop.sh exist"
|
|
17
|
-
else
|
|
18
|
-
echo "stop.sh create"
|
|
19
|
-
curl -O https://raw.githubusercontent.com/things-factory/things-factory/master/packages/operato-codelingua/installer/stop.sh
|
|
20
|
-
fi
|
|
21
|
-
|
|
22
|
-
if [ -f "upgrade.sh" ] ; then
|
|
23
|
-
echo "upgrade.sh exist"
|
|
24
|
-
else
|
|
25
|
-
echo "upgrade.sh create"
|
|
26
|
-
curl -O https://raw.githubusercontent.com/things-factory/things-factory/master/packages/operato-codelingua/installer/upgrade.sh
|
|
27
|
-
fi
|
|
28
|
-
|
|
29
|
-
if [ -f "migrate.sh" ] ; then
|
|
30
|
-
echo "migrate.sh exist"
|
|
31
|
-
else
|
|
32
|
-
echo "migrate.sh create"
|
|
33
|
-
curl -O https://raw.githubusercontent.com/things-factory/things-factory/master/packages/operato-codelingua/installer/migrate.sh
|
|
34
|
-
fi
|
|
35
|
-
|
|
36
|
-
if [ -f "docker-compose.yml" ] ; then
|
|
37
|
-
echo "docker-compose.yml exist"
|
|
38
|
-
else
|
|
39
|
-
echo "docker-compose.yml create"
|
|
40
|
-
curl -O https://raw.githubusercontent.com/things-factory/things-factory/master/packages/operato-codelingua/installer/docker-compose.yml
|
|
41
|
-
fi
|
|
42
|
-
|
|
43
|
-
chmod u+x start.sh
|
|
44
|
-
chmod u+x stop.sh
|
|
45
|
-
chmod u+x upgrade.sh
|
|
46
|
-
chmod u+x migrate.sh
|
|
47
|
-
|
|
48
|
-
echo "HostPort=3000" > .env
|
|
49
|
-
|
|
50
|
-
docker pull hatiolab/operato-codelingua:latest
|
|
51
|
-
|
|
52
|
-
docker pull hatiolab/operato-nginx:latest
|
|
53
|
-
|
|
54
|
-
docker-compose create
|
package/installer/migrate.sh
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
docker exec -it operato-codelingua npm run migration -- --mode=production
|
package/installer/start.sh
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
HOST_PORT=3000
|
|
2
|
-
|
|
3
|
-
if [ $# -eq 0 ] ; then
|
|
4
|
-
echo "Warning: default port 3000"
|
|
5
|
-
else
|
|
6
|
-
HOST_PORT=$1
|
|
7
|
-
fi
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
echo "HOST_PORT : ${HOST_PORT}"
|
|
11
|
-
|
|
12
|
-
echo "HostPort="$HOST_PORT > .env
|
|
13
|
-
|
|
14
|
-
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
|
15
|
-
xhost +"local:docker@"
|
|
16
|
-
fi
|
|
17
|
-
|
|
18
|
-
docker-compose up -d
|
package/installer/stop.sh
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
docker-compose stop
|
package/installer/upgrade.sh
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
curl -fsSL https://raw.githubusercontent.com/things-factory/things-factory/master/packages/operato-codelingua/installer/install.sh | bash -s
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import fetch, { Response } from 'node-fetch'
|
|
2
|
-
|
|
3
|
-
const GITHUB_API_URL = 'https://api.github.com'
|
|
4
|
-
|
|
5
|
-
const fetchOptions = (token: string) => ({
|
|
6
|
-
headers: {
|
|
7
|
-
'Content-Type': 'application/json',
|
|
8
|
-
Authorization: `token ${token}`
|
|
9
|
-
}
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
const handleFetchError = (response: Response, action: string) => {
|
|
13
|
-
if (!response.ok) {
|
|
14
|
-
console.error(`Failed to ${action}:`, response.statusText)
|
|
15
|
-
throw new Error(`Failed to ${action}`)
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const getWebhooks = async (repoFullName: string, token: string): Promise<any[]> => {
|
|
20
|
-
const response: Response = await fetch(`${GITHUB_API_URL}/repos/${repoFullName}/hooks`, fetchOptions(token))
|
|
21
|
-
handleFetchError(response, 'fetch webhooks')
|
|
22
|
-
return response.json()
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const webhookExists = async (
|
|
26
|
-
repoFullName: string,
|
|
27
|
-
webhookUrl: string,
|
|
28
|
-
token: string
|
|
29
|
-
): Promise<{ exists: boolean; id?: number }> => {
|
|
30
|
-
try {
|
|
31
|
-
const hooks: any[] = await getWebhooks(repoFullName, token)
|
|
32
|
-
const hook = hooks.find((hook: any) => hook.config.url === webhookUrl)
|
|
33
|
-
return hook ? { exists: true, id: hook.id } : { exists: false }
|
|
34
|
-
} catch (error) {
|
|
35
|
-
console.error('Error checking webhook existence:', error)
|
|
36
|
-
return { exists: false }
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export const postGitHubComment = async (repoFullName: string, commitId: string, comment: string): Promise<void> => {
|
|
41
|
-
try {
|
|
42
|
-
const response: Response = await fetch(`${GITHUB_API_URL}/repos/${repoFullName}/commits/${commitId}/comments`, {
|
|
43
|
-
method: 'POST',
|
|
44
|
-
...fetchOptions(process.env.GITHUB_API_KEY!),
|
|
45
|
-
body: JSON.stringify({ body: comment })
|
|
46
|
-
})
|
|
47
|
-
handleFetchError(response, 'post GitHub comment')
|
|
48
|
-
} catch (error) {
|
|
49
|
-
console.error('Error posting GitHub comment:', error)
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export const registerWebhook = async (accessToken: string, repoFullName: string, webhookUrl: string) => {
|
|
54
|
-
const { exists } = await webhookExists(repoFullName, webhookUrl, accessToken)
|
|
55
|
-
if (exists) {
|
|
56
|
-
console.log('Webhook already registered.')
|
|
57
|
-
return
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
try {
|
|
61
|
-
const response: Response = await fetch(`${GITHUB_API_URL}/repos/${repoFullName}/hooks`, {
|
|
62
|
-
method: 'POST',
|
|
63
|
-
...fetchOptions(accessToken),
|
|
64
|
-
body: JSON.stringify({
|
|
65
|
-
name: 'web',
|
|
66
|
-
active: true,
|
|
67
|
-
events: ['push'],
|
|
68
|
-
config: {
|
|
69
|
-
url: webhookUrl,
|
|
70
|
-
content_type: 'json'
|
|
71
|
-
}
|
|
72
|
-
})
|
|
73
|
-
})
|
|
74
|
-
handleFetchError(response, 'register webhook')
|
|
75
|
-
console.log('Webhook registered successfully.')
|
|
76
|
-
} catch (error) {
|
|
77
|
-
console.error('Error registering webhook:', error)
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export const unregisterWebhook = async (accessToken: string, repoFullName: string, webhookUrl: string) => {
|
|
82
|
-
const { exists, id } = await webhookExists(repoFullName, webhookUrl, accessToken)
|
|
83
|
-
if (!exists || !id) {
|
|
84
|
-
console.log('Webhook not found.')
|
|
85
|
-
return
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
try {
|
|
89
|
-
const deleteResponse: Response = await fetch(`${GITHUB_API_URL}/repos/${repoFullName}/hooks/${id}`, {
|
|
90
|
-
method: 'DELETE',
|
|
91
|
-
...fetchOptions(accessToken)
|
|
92
|
-
})
|
|
93
|
-
handleFetchError(deleteResponse, 'unregister webhook')
|
|
94
|
-
console.log('Webhook unregistered successfully.')
|
|
95
|
-
} catch (error) {
|
|
96
|
-
console.error('Error unregistering webhook:', error)
|
|
97
|
-
}
|
|
98
|
-
}
|
|
File without changes
|
package/server/index.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
const glob = require('glob')
|
|
2
|
-
const path = require('path')
|
|
3
|
-
|
|
4
|
-
export var migrations = []
|
|
5
|
-
|
|
6
|
-
glob.sync(path.resolve(__dirname, '.', '**', '*.js')).forEach(function(file) {
|
|
7
|
-
if (file.indexOf('index.js') !== -1) return
|
|
8
|
-
migrations = migrations.concat(Object.values(require(path.resolve(file))) || [])
|
|
9
|
-
})
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import Router from 'koa-router'
|
|
2
|
-
import { codereviewCompletion } from '@things-factory/codelingua'
|
|
3
|
-
|
|
4
|
-
import { postGitHubComment } from '../controllers/github-controller'
|
|
5
|
-
import { getRepository } from '@things-factory/shell'
|
|
6
|
-
import { GitProject } from '../service/git-project/git-project'
|
|
7
|
-
|
|
8
|
-
export const githubWebhookRouter = new Router()
|
|
9
|
-
|
|
10
|
-
githubWebhookRouter.post('/github-webhook/:projectId', async (context, next) => {
|
|
11
|
-
const { payload, head_commit } = context.request.body
|
|
12
|
-
const { commitDiff } = head_commit.diff
|
|
13
|
-
// const { commits, pull_request } = payload
|
|
14
|
-
const projectId = context.params.projectId
|
|
15
|
-
|
|
16
|
-
const project = await getRepository(GitProject).findOne({
|
|
17
|
-
where: {
|
|
18
|
-
id: projectId
|
|
19
|
-
}
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
if (!project) {
|
|
23
|
-
context.status = 404
|
|
24
|
-
context.body = 'Project not found'
|
|
25
|
-
return
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// for (const commit of commits) {
|
|
29
|
-
// const codeDiff = `diff of the changed code here` // 실제 diff 데이터를 가져오는 로직 필요
|
|
30
|
-
// const reviewFeedback = await codereviewCompletion(codeDiff)
|
|
31
|
-
// const pullNumber = pull_request.number // 풀 리퀘스트 번호를 받아옴
|
|
32
|
-
// await postGitHubComment(project.repositoryUrl, pullNumber, reviewFeedback)
|
|
33
|
-
// }
|
|
34
|
-
|
|
35
|
-
const reviewFeedback = await codereviewCompletion(commitDiff)
|
|
36
|
-
|
|
37
|
-
await postGitHubComment(
|
|
38
|
-
context.request.body.repository.full_name,
|
|
39
|
-
context.request.body.head_commit.id,
|
|
40
|
-
reviewFeedback
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
context.status = 200
|
|
44
|
-
context.body = 'Success'
|
|
45
|
-
})
|
package/server/routes.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { githubWebhookRouter } from './routers/github-webhook-router'
|
|
2
|
-
|
|
3
|
-
process.on('bootstrap-module-global-public-route' as any, (app, globalPublicRouter) => {
|
|
4
|
-
/*
|
|
5
|
-
* can add global public routes to application (auth not required, tenancy not required)
|
|
6
|
-
*
|
|
7
|
-
* ex) routes.get('/path', async(context, next) => {})
|
|
8
|
-
* ex) routes.post('/path', async(context, next) => {})
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
globalPublicRouter.use('', githubWebhookRouter.routes(), githubWebhookRouter.allowedMethods())
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
process.on('bootstrap-module-global-private-route' as any, (app, globalPrivateRouter) => {
|
|
15
|
-
/*
|
|
16
|
-
* can add global private routes to application (auth required, tenancy not required)
|
|
17
|
-
*/
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
process.on('bootstrap-module-domain-public-route' as any, (app, domainPublicRouter) => {
|
|
21
|
-
/*
|
|
22
|
-
* can add domain public routes to application (auth not required, tenancy required)
|
|
23
|
-
*/
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
process.on('bootstrap-module-domain-private-route' as any, (app, domainPrivateRouter) => {
|
|
27
|
-
/*
|
|
28
|
-
* can add domain private routes to application (auth required, tenancy required)
|
|
29
|
-
*/
|
|
30
|
-
})
|