Skip to content
This repository has been archived by the owner on Apr 24, 2023. It is now read-only.

Commit

Permalink
add auth-server cms-server graphql-server server-common
Browse files Browse the repository at this point in the history
  • Loading branch information
abz53378 committed Feb 1, 2019
1 parent cb27a41 commit bb134d2
Show file tree
Hide file tree
Showing 46 changed files with 676 additions and 25 deletions.
139 changes: 139 additions & 0 deletions docs/schema/test.schema.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
/** @jsx builder */

import builder, {Default, Condition, Block, Row, Col} from 'canner-script';
import moment from 'moment-timezone';

const ceDesc = `All events that had been collected so far.`;

export function renderDate(date, record, cannerProps) {
if (!date) {
return '-';
} else {
let value = moment.tz(date, "Asia/Nicosia").format("YYYY/MM/DD HH:mm");
return value;
}
}

export default () => (
<array keyName="events" title="Events" ui="table" description={ceDesc}
uiParams={{
size: "small",
columns: [{
title: 'Translated',
dataIndex: 'translated'
}, {
title: 'Ready',
dataIndex: 'ready'
}, {
title: 'Title',
dataIndex: 'title'
}, {
title: 'Date Start',
dataIndex: 'dateStart',
render: renderDate
}, {
title: 'Date End',
dataIndex: 'dateEnd',
render: renderDate
}, {
title: 'City',
dataIndex: 'city'
}, {
title: 'Tags',
dataIndex: 'tags'
}]
}}
>
<toolbar>
<pagination/>
<actions>
<filter />
<export />
</actions>
<filter>
<textFilter field="city" label="City" placeholder="Nicosia"/>
<textFilter field="title" label="Title"/>
<dateFilter field="dateStart" label="Date start"/>
<selectFilter field="translated" label="Translated" defaultOptionIndex={0} alwaysDisplay options={[
{ text: "Not translated", condition: { translated: { eq: false } } },
{ text: "Translated", condition: { translated: { eq: true } } },
{ text: "All", condition: {} }
]}/>
<selectFilter field="ready" label="Ready" options={[
{ text: "Not ready", condition: { ready: { eq: false } }},
{ text: "Ready", condition: { ready: { eq: true } }},
{ text: "All", condition: {}},
]}/>
<selectFilter field="old" label="Old" defaultOptionIndex={0} options={[
{ text: "Only new", condition: { old: { eq: false }} },
{ text: "Old", condition: { old: { eq: true } }},
{ text: "All", condition: {}},
]}/>
</filter>
<sorter defaultField="dateStart" options={[{label: 'Date Start', field: 'dateStart', defaultOrder: 'ASC'}]}/>
</toolbar>
<Row>
<Col span={12}>
<Block title="Original event">
<Row>
<Col span={12}>
<dateTime keyName="dateStart" ui="dateTime" uiParams={{format:"YYYY/MM/DD HH:mm", render:renderDate}} title="Date start"/>
<dateTime keyName="dateEnd" ui="dateTime" uiParams={{format:"YYYY/MM/DD HH:mm", render:renderDate}} title="Date end"/>
<string keyName="url" ui="link" title="URL" disabled={true}/>
<string keyName="parentUrl" ui="link" title="Parent URL" disabled={true}/>
</Col>
<Col span={11} offset={1}>
<image keyName="thumbnail" ui="image" title="Thumbnail" disabled={true}/>
</Col>
</Row>
</Block>
</Col>
<Col span={11} offset={1}>
<Block title="Common classification">
<array keyName="tags" ui="tag" title="Tags" uiParams={{
defaultOptions: [
'theater', 'movie', 'party',
'festival', 'kids', 'concert',
'play', 'masterclass', 'music',
'tasting', 'exhibition', 'sport'
]}}/>
<string keyName="city" ui="select" title="City" uiParams={{options: [{text:"Nicosia", value: "Nicosia"}, {text:"Larnaca", value: "Larnaca"}, {text:"Paphos", value: "Paphos"}, {text:"Limassol", value: "Limassol"},]}}/>
<string keyName="language" ui="input" title="Event language"/>
</Block>
</Col>
</Row>
<Row type="flex" style={{alignItems: 'center'}}>
<Col span={12}>
<string keyName="title" ui="input" title="Title" disabled={true}/>
<Row>
<Col span={8}><string keyName="location" ui="input" title="Location" disabled={true}/></Col>
<Col span={15} offset={1}><string keyName="address" ui="input" title="Address" disabled={true}/></Col>
</Row>
<string keyName="description" ui="textarea" title="Description" disabled={true}/>
</Col>
<Col span={12}>
<array keyName="translation" title="Translations" ui="tabTop" uiParams={{titleKey: "language", position: "right"}}>
<string keyName="language" title="Language" ui="select" uiParams={{options: [{text: 'Russian', value: 'ru'}, {text: "English", value: 'en'}, {text: "Greek", value: 'el'}]}}/>
<string keyName="title" title="Title" ui="input"/>
<Row>
<Col span={8}><string keyName="location" ui="input" title="Location"/></Col>
<Col span={15} offset={1}><string keyName="address" ui="input" title="Address"/></Col>
</Row>
<string keyName="description" ui="textarea" title="Description"/>
<string keyName="contact" ui="input" title="Contact and details"/>
</array>
</Col>
</Row>
<Row>
<Block title="Event control">
<Row>
<Col span={5}><boolean keyName="translated" ui="switch" title="Mark as translated"/></Col>
<Col span={5}><boolean keyName="ready" ui="switch" title="Ready"/></Col>
<Col span={5}><boolean keyName="loaded" ui="switch" title="Loaded"/></Col>
<Col span={5}><boolean keyName="old" ui="switch" title="Old"/></Col>
<Col span={5}><string keyName="source" ui="input" title="Event Source" disabled={true}/></Col>
</Row>
</Block>
</Row>
</array>
);
85 changes: 85 additions & 0 deletions packages/auth-server/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
"name": "@canner/auth-server",
"version": "0.0.0",
"description": "The auth server",
"author": "Canner",
"files": [
"lib"
],
"main": "lib/index.js",
"typings": "./lib/index.d.ts",
"scripts": {
"lint": "tslint -c tslint.json src/**/*.ts",
"test": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' mocha --timeout 10000 --compilers ts:ts-node/register --recursive --exit \"test/**/*.spec.ts\"",
"clean": "rimraf lib dist",
"prebuild": "npm run clean",
"build": "tsc -p ./tsconfig.release.json --pretty && copyfiles -u 4 \"src/web/server/views/**/*\" lib/web/server/views",
"prepublishOnly": "npm run clean && npm run build"
},
"publishConfig": {
"access": "public"
},
"dependencies": {
"@canner/server-common": "^0.0.0",
"@gqlify/canner-schema-to-gqlify-model": "^1.1.2",
"@gqlify/server": "^2.1.0",
"apollo-server": "^2.3.1",
"apollo-server-koa": "^2.3.1",
"bluebird": "^3.5.3",
"boom": "^7.3.0",
"graphql": "^14.1.1",
"graphql-iso-date": "^3.6.1",
"graphql-middleware": "^3.0.1",
"graphql-tools": "^4.0.4",
"graphql-type-json": "^0.2.1",
"html-webpack-plugin": "^3.2.0",
"ignore-loader": "^0.1.2",
"jsonwebtoken": "^8.4.0",
"jwks-rsa": "^1.3.0",
"koa": "^2.6.2",
"koa-mount": "^4.0.0",
"koa-router": "^7.4.0",
"koa-send": "^5.0.0",
"koa-static": "^5.0.0",
"koa-views": "^6.1.5",
"lodash": "^4.17.5",
"lowdb": "^1.0.0",
"minimist": "^1.2.0",
"node-jose": "^1.1.0",
"openid-client": "^2.4.5",
"pluralize": "^7.0.0",
"pug": "^2.0.3",
"rimraf": "^2.5.4",
"simple-oidc-server": "^1.2.3",
"speed-measure-webpack-plugin": "^1.2.5",
"tmp": "^0.0.33",
"ts-node": "^5.0.1",
"tslint": "^5.9.1",
"typescript": "^2.7.2"
},
"devDependencies": {
"@types/bluebird": "^3.5.25",
"@types/boom": "^7.2.1",
"@types/jsonwebtoken": "^8.3.0",
"@types/koa": "^2.0.48",
"@types/koa-mount": "^3.0.1",
"@types/koa-router": "^7.0.37",
"@types/koa-send": "^4.1.1",
"@types/koa-static": "^4.0.0",
"@types/lodash": "^4.14.107",
"@types/minimist": "^1.2.0",
"@types/node": "^9.4.6",
"@types/webpack": "^4.4.22",
"@types/webpack-dev-server": "^3.1.1",
"copyfiles": "^2.1.0",
"tslint-react": "^3.6.0"
},
"peerDependencies": {
"graphql": "*",
"graphql-iso-date": "*",
"graphql-type-json": "*",
"@canner/server-common": "*"
},
"repository": "Canner/canner",
"license": "MIT"
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createApp } from 'simple-oidc-server';
import koaMount from 'koa-mount';
import Koa from 'koa';
import { WebService, Logger } from '../common/interface';
import { WebService, Logger } from '@canner/server-common/lib/interface';
import { AuthConfig } from './config';

export class AuthService implements WebService {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AppConfig } from 'simple-oidc-server/lib/config';
import { Logger } from '../common/interface';
import { Logger } from '@canner/server-common/lib/interface';

export interface AuthConfig extends AppConfig {
mountPath?: string;
Expand Down
11 changes: 11 additions & 0 deletions packages/auth-server/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "../../tsconfig.json",
"include": ["*.ts", "**/*.ts"],
"exclude": ["./node_modules"],
"compilerOptions": {
"composite": true
},
"references": [
{ "path": "../server-common" }
]
}
10 changes: 10 additions & 0 deletions packages/auth-server/tsconfig.release.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "../../tsconfig.release.json",
"include": ["src/**/*.ts"],
"exclude": ["test/**/*.ts"],
"module": "ESNext",
"compilerOptions": {
"rootDir": "src",
"outDir": "lib",
}
}
20 changes: 20 additions & 0 deletions packages/auth-server/tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"exclude": ["node_modules", "lib"],
"extends": ["tslint:latest", "tslint-react"],
"rules": {
"ordered-imports": [
true,
{
"import-sources-order": "any",
"named-imports-order": "any"
}
],
"quotemark": [true, "single"],
"no-implicit-dependencies": [true, "dev"],
"no-submodule-imports": false,
"object-literal-sort-keys": false,
"trailing-comma": false,
"arrow-parens": [true, "ban-single-arg-parens"],
"interface-name": [true, "never-prefix"]
}
}
5 changes: 4 additions & 1 deletion packages/canner-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"main": "lib/index.js",
"typings": "./lib/index.d.ts",
"scripts": {
"web:start": "npm run web:statics:build && npm run web:dataSources && npm run web:server",
"gqlify:server": "NODE_ENV=development ts-node src/gqlify/bin/www.ts",
"lint": "tslint -c tslint.json src/**/*.ts",
"test": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' mocha --timeout 10000 --compilers ts:ts-node/register --recursive --exit \"test/**/*.spec.ts\"",
Expand All @@ -22,6 +21,10 @@
"access": "public"
},
"dependencies": {
"@canner/auth-server": "0.0.0",
"@canner/graphql-server": "0.0.0",
"@canner/cms-server": "0.0.0",
"@canner/server-common": "0.0.0",
"@gqlify/canner-schema-to-gqlify-model": "^1.1.2",
"@gqlify/server": "^2.1.0",
"apollo-server": "^2.3.1",
Expand Down
6 changes: 3 additions & 3 deletions packages/canner-server/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import Koa from 'koa';
import { construct } from './config/factory';

// Service
import { GraphQLService } from './gqlify/app';
import { CmsWebService } from './web/server/app';
import { AuthService } from './auth/app';
import { GraphQLService } from '@canner/graphql-server/lib/app';
import { CmsWebService } from '@canner/cms-server/lib/server/app';
import { AuthService } from '@canner/auth-server/lib/app';
import { ServerConfig } from './config/interface';
import { get } from 'lodash';

Expand Down
8 changes: 4 additions & 4 deletions packages/canner-server/src/config/factory.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ServerConfig } from './interface';
import { CmsServerConfig } from '../web/server/config';
import { GqlifyConfig } from '../gqlify/config';
import { CmsServerConfig } from '@canner/cms-server/lib/server/config';
import { GqlifyConfig } from '@canner/graphql-server/lib/config';
import { get, defaultTo, merge } from 'lodash';
import { RootAppConfig } from '../app';
import { AuthConfig } from '../auth/config';
import { jsonLogger } from '../common/jsonLogger';
import { AuthConfig } from '@canner/auth-server/lib/config';
import { jsonLogger } from '@canner/server-common/lib/jsonLogger';

const defaultConfig = {
cookieKeys: ['canner-secret'],
Expand Down
8 changes: 4 additions & 4 deletions packages/canner-server/src/config/interface.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CmsServerConfig } from '../web/server/config';
import { GqlifyConfig } from '../gqlify/config';
import { AuthConfig } from '../auth/config';
import { IssuerConfig } from '../common/oidcTokenVerifier';
import { CmsServerConfig } from '@canner/cms-server/lib/server/config';
import { GqlifyConfig } from '@canner/graphql-server/lib/config';
import { AuthConfig } from '@canner/auth-server/lib/config';
import { IssuerConfig } from '@canner/server-common/lib/oidcTokenVerifier';

export interface CommonConfig {
hostname: string;
Expand Down
8 changes: 7 additions & 1 deletion packages/canner-server/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
{
"extends": "../../tsconfig.json",
"include": ["*.ts", "**/*.ts"],
"exclude": ["./node_modules"]
"exclude": ["./node_modules"],
"references": [
{ "path": "../server-common" },
{ "path": "../auth-server" },
{ "path": "../graphql-server" },
{ "path": "../cms-server" }
]
}
Loading

0 comments on commit bb134d2

Please sign in to comment.