Skip to content

Commit

Permalink
update credit model
Browse files Browse the repository at this point in the history
  • Loading branch information
Pratap2018 committed Aug 20, 2024
1 parent 320c14e commit 87d960f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
19 changes: 17 additions & 2 deletions src/credits/schemas/authz.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,19 @@ export enum scope {

export type AuthZCreditsDocument = AuthZCredits & Document;

@Schema()
class Amount {
@Prop({
type: String,
})
denom: string;

@Prop({
type: String,
})
amount: string;
}

@Schema({ timestamps: true })
export class AuthZCredits {
@IsNotEmpty()
Expand All @@ -33,8 +46,10 @@ export class AuthZCredits {
})
expires: string;

@Prop()
creditAmmountInUhid: string;
@Prop({
type: Amount,
})
credit: Amount;
@Prop({
type: [String],
enum: scope,
Expand Down
5 changes: 4 additions & 1 deletion src/credits/services/credits.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ export class AuthzCreditService {
appId: authz.appId,
expires: new Date(Date.now() + 365 * 24 * 60 * 60 * 1000).toISOString(),
// created: new Date().toISOString(),
creditAmmountInUhid: this.config.get('BASIC_ALLOWANCE') || '5000000uhid',
credit: {
amount: this.config.get('BASIC_ALLOWANCE') || '5000000',
denom: 'uhid',
},
creditScope: [
scope.MsgRegisterDID,
scope.MsgDeactivateDID,
Expand Down

0 comments on commit 87d960f

Please sign in to comment.