Skip to content

Commit a39edd3

Browse files
authored
Merge pull request #81 from hypersign-protocol/develop
Develop
2 parents 5a899c9 + 0172d6d commit a39edd3

File tree

51 files changed

+2961
-48
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+2961
-48
lines changed

.deploy/deployment.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,14 @@ spec:
9999
value: "__REDIS_HOST__"
100100
- name: KYC_VERIFIER_APP_BASE_URL
101101
value: "__KYC_VERIFIER_APP_BASE_URL__"
102+
- name: OTP_COOLDOWN_MINUTES
103+
value: '__OTP_COOLDOWN_MINUTES__'
104+
- name: OTP_HOURLY_LIMIT
105+
value: '__OTP_HOURLY_LIMIT__'
106+
- name: OTP_EXPIRY_MINUTES
107+
value: '__OTP_EXPIRY_MINUTES__'
108+
- name: MAX_RETRY_ATTEMPT
109+
value: '__MAX_RETRY_ATTEMPT__'
102110
volumeMounts:
103111
- name: mongo
104112
mountPath: "/data"

.github/workflows/pipeline.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,5 +139,13 @@ jobs:
139139
run: find .deploy/deployment.yaml -type f -exec sed -i -e "s#__GEOLOCATION_DB_PATH__#${{ secrets.GEOLOCATION_DB_PATH }}#" {} \;
140140
- name: "Replace Secrets"
141141
run: find .deploy/deployment.yaml -type f -exec sed -i -e "s#__NODE_ENV__#${{ secrets.NODE_ENV }}#" {} \;
142+
- name: "Replace Secrets"
143+
run: find .deploy/deployment.yaml -type f -exec sed -i -e "s#__OTP_COOLDOWN_MINUTES__#${{ secrets.OTP_COOLDOWN_MINUTES }}#" {} \;
144+
- name: "Replace Secrets"
145+
run: find .deploy/deployment.yaml -type f -exec sed -i -e "s#__OTP_HOURLY_LIMIT__#${{ secrets.OTP_HOURLY_LIMIT }}#" {} \;
146+
- name: "Replace Secrets"
147+
run: find .deploy/deployment.yaml -type f -exec sed -i -e "s#__OTP_EXPIRY_MINUTES__#${{ secrets.OTP_EXPIRY_MINUTES }}#" {} \;
148+
- name: "Replace Secrets"
149+
run: find .deploy/deployment.yaml -type f -exec sed -i -e "s#__MAX_RETRY_ATTEMPT__#${{ secrets.MAX_RETRY_ATTEMPT }}#" {} \;
142150
- name: "Deploy to GKE"
143151
run: kubectl apply -f .deploy/deployment.yaml

dev.env.sample

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ GOOGLE_CLIENT_SECRET=
1818
GOOGLE_AUTH_BASE_URL=
1919
REDIS_HOST='localhost'
2020
KYC_VERIFIER_APP_BASE_URL=
21-
21+
OTP_COOLDOWN_MINUTES=1
22+
OTP_HOURLY_LIMIT=10
23+
OTP_EXPIRY_MINUTES=5
24+
MAX_RETRY_ATTEMPT=3
2225
NODE_ENV=development
2326

2427

src/app-auth/app-auth.module.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {
2+
forwardRef,
23
MiddlewareConsumer,
34
Module,
45
NestModule,
@@ -31,6 +32,7 @@ import {
3132
AdminPeopleSchema,
3233
} from 'src/people/schema/people.schema';
3334
import { RateLimitMiddleware } from 'src/utils/middleware/rate-limit.middleware';
35+
import { WebpageConfigModule } from 'src/webpage-config/webpage-config.module';
3436

3537
@Module({
3638
imports: [
@@ -43,6 +45,7 @@ import { RateLimitMiddleware } from 'src/utils/middleware/rate-limit.middleware'
4345
UserModule,
4446
JwtModule.register({}),
4547
CreditModule,
48+
forwardRef(() => WebpageConfigModule),
4649
],
4750
providers: [
4851
AppAuthService,
@@ -56,7 +59,7 @@ import { RateLimitMiddleware } from 'src/utils/middleware/rate-limit.middleware'
5659
],
5760
controllers: [AppAuthController],
5861

59-
exports: [AppAuthService, AppRepository, AppAuthApiKeyService, AppAuthModule],
62+
exports: [AppAuthService, AppRepository, AppAuthApiKeyService],
6063
})
6164
export class AppAuthModule implements NestModule {
6265
configure(consumer: MiddlewareConsumer) {

src/app-auth/controllers/app-auth.controller.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import { AllExceptionsFilter } from '../../utils/utils';
3838
import { AppError, GetAppList } from '../dtos/fetch-app.dto';
3939
import { PaginationDto } from 'src/utils/pagination.dto';
4040
import { TransformResponseInterceptor } from '../interceptors/transformResponse.interseptor';
41+
import { UserRole } from 'src/user/schema/user.schema';
4142
@UseFilters(AllExceptionsFilter)
4243
@ApiTags('Application')
4344
@Controller('/api/v1/app')
@@ -77,10 +78,12 @@ export class AppAuthController {
7778
@Query() pageOption: PaginationDto,
7879
): Promise<App[]> {
7980
Logger.log('getApps() method: starts', 'AppAuthController');
81+
const userRole = req.user?.role ?? UserRole.ADMIN;
8082
const userId = req.user.userId;
8183
const appList: any = await this.appAuthService.getAllApps(
8284
userId,
8385
pageOption,
86+
userRole,
8487
);
8588
if (appList.length === 0) {
8689
throw new AppNotFoundException();
@@ -198,7 +201,7 @@ export class AppAuthController {
198201

199202
const app = await this.appAuthService.getAppById(appId, userId);
200203
if (app) {
201-
return this.appAuthService.updateAnApp(appId, updateAppDto, userId);
204+
return this.appAuthService.updateAnApp(appId, updateAppDto, req.user);
202205
} else throw new AppNotFoundException();
203206
}
204207

src/app-auth/dtos/create-app.dto.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export class CreateAppDto {
5252
@IsOptional()
5353
@IsString()
5454
@MaxLength(100)
55-
description: string;
55+
description?: string;
5656
@ApiProperty({
5757
description: 'logoUrl',
5858
example: 'http://image.png',
@@ -61,7 +61,7 @@ export class CreateAppDto {
6161
@IsOptional()
6262
@IsString()
6363
@IsUrlEmpty()
64-
logoUrl: string;
64+
logoUrl?: string;
6565
@ApiProperty({
6666
description: 'services',
6767
example: [SERVICE_TYPES.SSI_API],
@@ -90,7 +90,7 @@ export class CreateAppDto {
9090
})
9191
@IsOptional()
9292
@IsArray()
93-
dependentServices: Array<string>; // ids of dependent services / apps
93+
dependentServices?: Array<string>; // ids of dependent services / apps
9494

9595
@ApiProperty({
9696
description: 'environment',
@@ -112,7 +112,7 @@ export class CreateAppDto {
112112
})
113113
@IsOptional()
114114
@IsString()
115-
issuerDid: string;
115+
issuerDid?: string;
116116

117117
@ApiProperty({
118118
description: 'issuerVerificationMethodId',
@@ -121,7 +121,7 @@ export class CreateAppDto {
121121
})
122122
@IsOptional()
123123
@IsString()
124-
issuerVerificationMethodId: string;
124+
issuerVerificationMethodId?: string;
125125
@ApiProperty({
126126
description: 'domain',
127127
example: 'hypersign.id',
@@ -139,7 +139,7 @@ export class CreateAppDto {
139139
})
140140
@IsOptional()
141141
@IsBoolean()
142-
hasDomainVerified: boolean;
142+
hasDomainVerified?: boolean;
143143
}
144144

145145
export class DeleteAppResponse {

src/app-auth/repositories/app.repository.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export class AppRepository {
1313
private readonly supportedServices: SupportedServiceService,
1414
) {}
1515

16-
private appDataProjectPipelineToReturn() {
16+
public appDataProjectPipelineToReturn() {
1717
return {
1818
appName: 1,
1919
appId: 1,

src/app-auth/schemas/app.schema.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { supportedServiceResponseDto } from 'src/supported-service/dto/create-su
1313
import { APP_ENVIRONMENT } from 'src/supported-service/services/iServiceList';
1414
export type AppDocument = App & Document;
1515

16-
@Schema()
16+
@Schema({ timestamps: true })
1717
export class App {
1818
@ApiHideProperty()
1919
@Prop()
@@ -72,7 +72,7 @@ export class App {
7272
@IsOptional()
7373
@IsString()
7474
@Prop({ required: false })
75-
description: string;
75+
description?: string;
7676

7777
@ApiProperty({
7878
description: 'whitelistedCors',
@@ -92,7 +92,7 @@ export class App {
9292
@IsString()
9393
@IsUrl()
9494
@Prop({ required: false })
95-
logoUrl: string;
95+
logoUrl?: string;
9696

9797
@IsOptional()
9898
@IsString()
@@ -114,7 +114,7 @@ export class App {
114114
})
115115
@IsArray()
116116
@Prop({ required: false })
117-
dependentServices: Array<string>;
117+
dependentServices?: Array<string>;
118118

119119
@IsOptional()
120120
@IsString()
@@ -128,7 +128,7 @@ export class App {
128128
required: false,
129129
})
130130
@Prop({ required: false })
131-
issuerDid: string;
131+
issuerDid?: string;
132132

133133
@IsOptional()
134134
@IsString()
@@ -137,7 +137,7 @@ export class App {
137137
required: false,
138138
})
139139
@Prop({ required: false })
140-
issuerVerificationMethodId: string;
140+
issuerVerificationMethodId?: string;
141141

142142
@IsOptional()
143143
@IsString()

0 commit comments

Comments
 (0)