@things-factory/operato-codelingua 8.0.0-beta.9 → 8.0.2
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 +6 -24
- package/client/bootstrap.ts +206 -0
- package/client/icons/menu-icons.ts +91 -0
- package/client/index.ts +0 -0
- package/client/pages/git-project/git-project-list-page.ts +427 -0
- package/client/route.ts +8 -0
- package/client/themes/dark.css +51 -0
- package/client/themes/light.css +51 -0
- package/client/tsconfig.json +12 -0
- package/client/viewparts/menu-tools.ts +170 -0
- package/client/viewparts/user-circle.ts +24 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/installer/config.production.js +40 -0
- package/installer/docker-compose.yml +42 -0
- package/installer/install.sh +54 -0
- package/installer/migrate.sh +1 -0
- package/installer/start.sh +18 -0
- package/installer/stop.sh +1 -0
- package/installer/upgrade.sh +1 -0
- package/package.json +48 -48
- package/server/controllers/github-controller.ts +98 -0
- package/server/controllers/index.ts +0 -0
- package/server/index.ts +7 -0
- package/server/middlewares/index.ts +3 -0
- package/server/migrations/index.ts +9 -0
- package/server/routers/github-webhook-router.ts +45 -0
- package/server/routes.ts +30 -0
- package/server/service/git-project/git-project-mutation.ts +179 -0
- package/server/service/git-project/git-project-query.ts +48 -0
- package/server/service/git-project/git-project-type.ts +76 -0
- package/server/service/git-project/git-project.ts +114 -0
- package/server/service/git-project/index.ts +7 -0
- package/server/service/index.ts +21 -0
- package/server/tsconfig.json +9 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'
|
|
2
|
+
import { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'
|
|
3
|
+
import { User } from '@things-factory/auth-base'
|
|
4
|
+
import { GitProject } from './git-project'
|
|
5
|
+
import { GitProjectList } from './git-project-type'
|
|
6
|
+
|
|
7
|
+
@Resolver(GitProject)
|
|
8
|
+
export class GitProjectQuery {
|
|
9
|
+
@Query(returns => GitProject!, { nullable: true, description: 'To fetch a GitProject' })
|
|
10
|
+
async gitProject(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<GitProject> {
|
|
11
|
+
const { domain } = context.state
|
|
12
|
+
|
|
13
|
+
return await getRepository(GitProject).findOne({
|
|
14
|
+
where: { domain: { id: domain.id }, id }
|
|
15
|
+
})
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@Query(returns => GitProjectList, { description: 'To fetch multiple GitProjects' })
|
|
19
|
+
async gitProjects(@Args(type => ListParam) params: ListParam, @Ctx() context: ResolverContext): Promise<GitProjectList> {
|
|
20
|
+
const { domain } = context.state
|
|
21
|
+
|
|
22
|
+
const queryBuilder = getQueryBuilderFromListParams({
|
|
23
|
+
domain,
|
|
24
|
+
params,
|
|
25
|
+
repository: await getRepository(GitProject),
|
|
26
|
+
searchables: ['name', 'description']
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
const [items, total] = await queryBuilder.getManyAndCount()
|
|
30
|
+
|
|
31
|
+
return { items, total }
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@FieldResolver(type => Domain)
|
|
35
|
+
async domain(@Root() gitProject: GitProject): Promise<Domain> {
|
|
36
|
+
return gitProject.domainId && (await getRepository(Domain).findOneBy({ id: gitProject.domainId }))
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@FieldResolver(type => User)
|
|
40
|
+
async updater(@Root() gitProject: GitProject): Promise<User> {
|
|
41
|
+
return gitProject.updaterId && (await getRepository(User).findOneBy({ id: gitProject.updaterId }))
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@FieldResolver(type => User)
|
|
45
|
+
async creator(@Root() gitProject: GitProject): Promise<User> {
|
|
46
|
+
return gitProject.creatorId && (await getRepository(User).findOneBy({ id: gitProject.creatorId }))
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { FileUpload } from 'graphql-upload/GraphQLUpload.js'
|
|
2
|
+
import GraphQLUpload from 'graphql-upload/GraphQLUpload.js'
|
|
3
|
+
import { ObjectType, Field, InputType, Int, ID, registerEnumType } from 'type-graphql'
|
|
4
|
+
|
|
5
|
+
import { ObjectRef, ScalarObject } from '@things-factory/shell'
|
|
6
|
+
|
|
7
|
+
import { GitProject, GitProjectStatus, GitProjectLanguage } from './git-project'
|
|
8
|
+
|
|
9
|
+
@InputType()
|
|
10
|
+
export class NewGitProject {
|
|
11
|
+
@Field()
|
|
12
|
+
name: string
|
|
13
|
+
|
|
14
|
+
@Field({ nullable: true })
|
|
15
|
+
description?: string
|
|
16
|
+
|
|
17
|
+
@Field({ nullable: true })
|
|
18
|
+
repositoryUrl?: string
|
|
19
|
+
|
|
20
|
+
@Field({ nullable: true })
|
|
21
|
+
apiKey?: string
|
|
22
|
+
|
|
23
|
+
@Field(type => GitProjectLanguage, { nullable: true })
|
|
24
|
+
language?: GitProjectLanguage
|
|
25
|
+
|
|
26
|
+
@Field(type => GitProjectStatus, { nullable: true })
|
|
27
|
+
state?: GitProjectStatus
|
|
28
|
+
|
|
29
|
+
@Field({ nullable: true })
|
|
30
|
+
active?: boolean
|
|
31
|
+
|
|
32
|
+
@Field({ nullable: true })
|
|
33
|
+
params?: string
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@InputType()
|
|
37
|
+
export class GitProjectPatch {
|
|
38
|
+
@Field(type => ID, { nullable: true })
|
|
39
|
+
id?: string
|
|
40
|
+
|
|
41
|
+
@Field({ nullable: true })
|
|
42
|
+
name?: string
|
|
43
|
+
|
|
44
|
+
@Field({ nullable: true })
|
|
45
|
+
description?: string
|
|
46
|
+
|
|
47
|
+
@Field({ nullable: true })
|
|
48
|
+
repositoryUrl?: string
|
|
49
|
+
|
|
50
|
+
@Field({ nullable: true })
|
|
51
|
+
webhookUrl?: string
|
|
52
|
+
|
|
53
|
+
@Field({ nullable: true })
|
|
54
|
+
apiKey?: string
|
|
55
|
+
|
|
56
|
+
@Field(type => GitProjectLanguage, { nullable: true })
|
|
57
|
+
language?: GitProjectLanguage
|
|
58
|
+
|
|
59
|
+
@Field(type => GitProjectStatus, { nullable: true })
|
|
60
|
+
state?: GitProjectStatus
|
|
61
|
+
|
|
62
|
+
@Field({ nullable: true })
|
|
63
|
+
active?: boolean
|
|
64
|
+
|
|
65
|
+
@Field({ nullable: true })
|
|
66
|
+
cuFlag?: string
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@ObjectType()
|
|
70
|
+
export class GitProjectList {
|
|
71
|
+
@Field(type => [GitProject])
|
|
72
|
+
items: GitProject[]
|
|
73
|
+
|
|
74
|
+
@Field(type => Int)
|
|
75
|
+
total: number
|
|
76
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CreateDateColumn,
|
|
3
|
+
UpdateDateColumn,
|
|
4
|
+
Entity,
|
|
5
|
+
Index,
|
|
6
|
+
Column,
|
|
7
|
+
RelationId,
|
|
8
|
+
ManyToOne,
|
|
9
|
+
PrimaryGeneratedColumn
|
|
10
|
+
} from 'typeorm'
|
|
11
|
+
import { ObjectType, Field, Int, ID, registerEnumType } from 'type-graphql'
|
|
12
|
+
|
|
13
|
+
import { Domain } from '@things-factory/shell'
|
|
14
|
+
import { User } from '@things-factory/auth-base'
|
|
15
|
+
|
|
16
|
+
export enum GitProjectStatus {
|
|
17
|
+
REGISTERED = 'REGISTERED',
|
|
18
|
+
READY = 'READY'
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
registerEnumType(GitProjectStatus, {
|
|
22
|
+
name: 'GitProjectStatus',
|
|
23
|
+
description: 'state enumeration of a gitProject'
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
export enum GitProjectLanguage {
|
|
27
|
+
javascript = 'javascript',
|
|
28
|
+
typescript = 'typescript',
|
|
29
|
+
java = 'java',
|
|
30
|
+
python = 'python',
|
|
31
|
+
c = 'c',
|
|
32
|
+
cpp = 'cpp'
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
registerEnumType(GitProjectLanguage, {
|
|
36
|
+
name: 'GitProjectLanguage',
|
|
37
|
+
description: 'language enumeration of a gitProject'
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
@Entity()
|
|
41
|
+
@Index('ix_git_project_0', (gitProject: GitProject) => [gitProject.domain, gitProject.name], {
|
|
42
|
+
unique: true
|
|
43
|
+
})
|
|
44
|
+
@ObjectType({ description: 'Entity for GitProject' })
|
|
45
|
+
export class GitProject {
|
|
46
|
+
@PrimaryGeneratedColumn('uuid')
|
|
47
|
+
@Field(type => ID)
|
|
48
|
+
readonly id: string
|
|
49
|
+
|
|
50
|
+
@ManyToOne(type => Domain)
|
|
51
|
+
@Field({ nullable: true })
|
|
52
|
+
domain?: Domain
|
|
53
|
+
|
|
54
|
+
@RelationId((gitProject: GitProject) => gitProject.domain)
|
|
55
|
+
domainId?: string
|
|
56
|
+
|
|
57
|
+
@Column()
|
|
58
|
+
@Field({ nullable: true })
|
|
59
|
+
name?: string
|
|
60
|
+
|
|
61
|
+
@Column({ nullable: true })
|
|
62
|
+
@Field({ nullable: true })
|
|
63
|
+
description?: string
|
|
64
|
+
|
|
65
|
+
@Column({ nullable: true })
|
|
66
|
+
@Field({ nullable: true })
|
|
67
|
+
repositoryUrl?: string
|
|
68
|
+
|
|
69
|
+
@Column({ nullable: true })
|
|
70
|
+
@Field({ nullable: true })
|
|
71
|
+
language?: GitProjectLanguage
|
|
72
|
+
|
|
73
|
+
@Column({ nullable: true })
|
|
74
|
+
@Field({ nullable: true })
|
|
75
|
+
apiKey?: string
|
|
76
|
+
|
|
77
|
+
@Column({ nullable: true })
|
|
78
|
+
@Field({ nullable: true })
|
|
79
|
+
active?: boolean
|
|
80
|
+
|
|
81
|
+
@Column({ nullable: true })
|
|
82
|
+
@Field({ nullable: true })
|
|
83
|
+
state?: GitProjectStatus
|
|
84
|
+
|
|
85
|
+
@Column({ nullable: true })
|
|
86
|
+
@Field({ nullable: true })
|
|
87
|
+
params?: string
|
|
88
|
+
|
|
89
|
+
@CreateDateColumn()
|
|
90
|
+
@Field({ nullable: true })
|
|
91
|
+
createdAt?: Date
|
|
92
|
+
|
|
93
|
+
@UpdateDateColumn()
|
|
94
|
+
@Field({ nullable: true })
|
|
95
|
+
updatedAt?: Date
|
|
96
|
+
|
|
97
|
+
@ManyToOne(type => User, { nullable: true })
|
|
98
|
+
@Field(type => User, { nullable: true })
|
|
99
|
+
creator?: User
|
|
100
|
+
|
|
101
|
+
@RelationId((gitProject: GitProject) => gitProject.creator)
|
|
102
|
+
creatorId?: string
|
|
103
|
+
|
|
104
|
+
@ManyToOne(type => User, { nullable: true })
|
|
105
|
+
@Field(type => User, { nullable: true })
|
|
106
|
+
updater?: User
|
|
107
|
+
|
|
108
|
+
@RelationId((gitProject: GitProject) => gitProject.updater)
|
|
109
|
+
updaterId?: string
|
|
110
|
+
|
|
111
|
+
get webhookUrl(): string {
|
|
112
|
+
return `https://codelingua.hatiolab.com/github-webhook/${this.id}`
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { GitProject } from './git-project'
|
|
2
|
+
import { GitProjectQuery } from './git-project-query'
|
|
3
|
+
import { GitProjectMutation } from './git-project-mutation'
|
|
4
|
+
|
|
5
|
+
export const entities = [GitProject]
|
|
6
|
+
export const resolvers = [GitProjectQuery, GitProjectMutation]
|
|
7
|
+
export const subscribers = []
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/* EXPORT ENTITY TYPES */
|
|
2
|
+
export * from './git-project/git-project'
|
|
3
|
+
|
|
4
|
+
/* IMPORT ENTITIES AND RESOLVERS */
|
|
5
|
+
import {
|
|
6
|
+
entities as GitProjectEntities,
|
|
7
|
+
resolvers as GitProjectResolvers,
|
|
8
|
+
subscribers as GitProjectSubscribers
|
|
9
|
+
} from './git-project'
|
|
10
|
+
|
|
11
|
+
export const entities = [
|
|
12
|
+
/* ENTITIES */
|
|
13
|
+
...GitProjectEntities
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
export const schema = {
|
|
17
|
+
resolverClasses: [
|
|
18
|
+
/* RESOLVER CLASSES */
|
|
19
|
+
...GitProjectResolvers
|
|
20
|
+
]
|
|
21
|
+
}
|