examples to new tsrpc-cli
This commit is contained in:
1
examples/user-authentication/frontend/src/shared
Symbolic link
1
examples/user-authentication/frontend/src/shared
Symbolic link
@@ -0,0 +1 @@
|
||||
../../backend/src/shared
|
@@ -1,14 +0,0 @@
|
||||
import { BaseRequest, BaseResponse, BaseConf } from '../base'
|
||||
|
||||
export interface ReqAdminAction extends BaseRequest {
|
||||
|
||||
}
|
||||
|
||||
export interface ResAdminAction extends BaseResponse {
|
||||
result: string
|
||||
}
|
||||
|
||||
export const conf: BaseConf = {
|
||||
needLogin: true,
|
||||
needRoles: ['Admin']
|
||||
};
|
@@ -1,13 +0,0 @@
|
||||
import { BaseConf, BaseRequest, BaseResponse } from '../base';
|
||||
|
||||
export interface ReqGuestAction extends BaseRequest {
|
||||
|
||||
}
|
||||
|
||||
export interface ResGuestAction extends BaseResponse {
|
||||
result: string
|
||||
}
|
||||
|
||||
export const conf: BaseConf = {
|
||||
needLogin: false
|
||||
};
|
@@ -1,13 +0,0 @@
|
||||
import { BaseConf, BaseRequest, BaseResponse } from '../base';
|
||||
|
||||
export interface ReqNormalAction extends BaseRequest {
|
||||
|
||||
}
|
||||
|
||||
export interface ResNormalAction extends BaseResponse {
|
||||
result: string
|
||||
}
|
||||
|
||||
export const conf: BaseConf = {
|
||||
needLogin: true
|
||||
};
|
@@ -1,13 +0,0 @@
|
||||
export interface BaseRequest {
|
||||
__ssoToken?: string;
|
||||
}
|
||||
|
||||
export interface BaseResponse {
|
||||
// Init or refresh sso token
|
||||
__ssoToken?: string;
|
||||
}
|
||||
|
||||
export interface BaseConf {
|
||||
needLogin?: boolean,
|
||||
needRoles?: string[]
|
||||
}
|
@@ -1,279 +0,0 @@
|
||||
import { ServiceProto } from 'tsrpc-proto';
|
||||
import { ReqAdminAction, ResAdminAction } from './action/PtlAdminAction';
|
||||
import { ReqGuestAction, ResGuestAction } from './action/PtlGuestAction';
|
||||
import { ReqNormalAction, ResNormalAction } from './action/PtlNormalAction';
|
||||
import { ReqLogin, ResLogin } from './user/PtlLogin';
|
||||
import { ReqLogout, ResLogout } from './user/PtlLogout';
|
||||
|
||||
export interface ServiceType {
|
||||
api: {
|
||||
"action/AdminAction": {
|
||||
req: ReqAdminAction,
|
||||
res: ResAdminAction
|
||||
},
|
||||
"action/GuestAction": {
|
||||
req: ReqGuestAction,
|
||||
res: ResGuestAction
|
||||
},
|
||||
"action/NormalAction": {
|
||||
req: ReqNormalAction,
|
||||
res: ResNormalAction
|
||||
},
|
||||
"user/Login": {
|
||||
req: ReqLogin,
|
||||
res: ResLogin
|
||||
},
|
||||
"user/Logout": {
|
||||
req: ReqLogout,
|
||||
res: ResLogout
|
||||
}
|
||||
},
|
||||
msg: {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
export const serviceProto: ServiceProto<ServiceType> = {
|
||||
"version": 2,
|
||||
"services": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "action/AdminAction",
|
||||
"type": "api",
|
||||
"conf": {
|
||||
"needLogin": true,
|
||||
"needRoles": [
|
||||
"Admin"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"name": "action/GuestAction",
|
||||
"type": "api",
|
||||
"conf": {
|
||||
"needLogin": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"name": "action/NormalAction",
|
||||
"type": "api",
|
||||
"conf": {
|
||||
"needLogin": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"name": "user/Login",
|
||||
"type": "api",
|
||||
"conf": {}
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"name": "user/Logout",
|
||||
"type": "api",
|
||||
"conf": {}
|
||||
}
|
||||
],
|
||||
"types": {
|
||||
"action/PtlAdminAction/ReqAdminAction": {
|
||||
"type": "Interface",
|
||||
"extends": [
|
||||
{
|
||||
"id": 0,
|
||||
"type": {
|
||||
"type": "Reference",
|
||||
"target": "base/BaseRequest"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"base/BaseRequest": {
|
||||
"type": "Interface",
|
||||
"properties": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "__ssoToken",
|
||||
"type": {
|
||||
"type": "String"
|
||||
},
|
||||
"optional": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"action/PtlAdminAction/ResAdminAction": {
|
||||
"type": "Interface",
|
||||
"extends": [
|
||||
{
|
||||
"id": 0,
|
||||
"type": {
|
||||
"type": "Reference",
|
||||
"target": "base/BaseResponse"
|
||||
}
|
||||
}
|
||||
],
|
||||
"properties": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "result",
|
||||
"type": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"base/BaseResponse": {
|
||||
"type": "Interface",
|
||||
"properties": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "__ssoToken",
|
||||
"type": {
|
||||
"type": "String"
|
||||
},
|
||||
"optional": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"action/PtlGuestAction/ReqGuestAction": {
|
||||
"type": "Interface",
|
||||
"extends": [
|
||||
{
|
||||
"id": 0,
|
||||
"type": {
|
||||
"type": "Reference",
|
||||
"target": "base/BaseRequest"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"action/PtlGuestAction/ResGuestAction": {
|
||||
"type": "Interface",
|
||||
"extends": [
|
||||
{
|
||||
"id": 0,
|
||||
"type": {
|
||||
"type": "Reference",
|
||||
"target": "base/BaseResponse"
|
||||
}
|
||||
}
|
||||
],
|
||||
"properties": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "result",
|
||||
"type": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"action/PtlNormalAction/ReqNormalAction": {
|
||||
"type": "Interface",
|
||||
"extends": [
|
||||
{
|
||||
"id": 0,
|
||||
"type": {
|
||||
"type": "Reference",
|
||||
"target": "base/BaseRequest"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"action/PtlNormalAction/ResNormalAction": {
|
||||
"type": "Interface",
|
||||
"extends": [
|
||||
{
|
||||
"id": 0,
|
||||
"type": {
|
||||
"type": "Reference",
|
||||
"target": "base/BaseResponse"
|
||||
}
|
||||
}
|
||||
],
|
||||
"properties": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "result",
|
||||
"type": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"user/PtlLogin/ReqLogin": {
|
||||
"type": "Interface",
|
||||
"extends": [
|
||||
{
|
||||
"id": 0,
|
||||
"type": {
|
||||
"type": "Reference",
|
||||
"target": "base/BaseRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"properties": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "username",
|
||||
"type": {
|
||||
"type": "String"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"name": "password",
|
||||
"type": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"user/PtlLogin/ResLogin": {
|
||||
"type": "Interface",
|
||||
"extends": [
|
||||
{
|
||||
"id": 0,
|
||||
"type": {
|
||||
"type": "Reference",
|
||||
"target": "base/BaseResponse"
|
||||
}
|
||||
}
|
||||
],
|
||||
"properties": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "__ssoToken",
|
||||
"type": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"user/PtlLogout/ReqLogout": {
|
||||
"type": "Interface",
|
||||
"extends": [
|
||||
{
|
||||
"id": 0,
|
||||
"type": {
|
||||
"type": "Reference",
|
||||
"target": "base/BaseRequest"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"user/PtlLogout/ResLogout": {
|
||||
"type": "Interface",
|
||||
"extends": [
|
||||
{
|
||||
"id": 0,
|
||||
"type": {
|
||||
"type": "Reference",
|
||||
"target": "base/BaseResponse"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
@@ -1,14 +0,0 @@
|
||||
import { BaseConf, BaseRequest, BaseResponse } from '../base';
|
||||
|
||||
export interface ReqLogin extends BaseRequest {
|
||||
username: string,
|
||||
password: string
|
||||
}
|
||||
|
||||
export interface ResLogin extends BaseResponse {
|
||||
__ssoToken: string;
|
||||
}
|
||||
|
||||
export const conf: BaseConf = {
|
||||
|
||||
};
|
@@ -1,13 +0,0 @@
|
||||
import { BaseRequest, BaseResponse, BaseConf } from '../base'
|
||||
|
||||
export interface ReqLogout extends BaseRequest {
|
||||
|
||||
}
|
||||
|
||||
export interface ResLogout extends BaseResponse {
|
||||
|
||||
}
|
||||
|
||||
export const conf: BaseConf = {
|
||||
|
||||
};
|
Reference in New Issue
Block a user