Skip to content

Commit

Permalink
Fix server tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn committed Jan 5, 2024
1 parent 1191b0d commit fc9f86e
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 77 deletions.
3 changes: 2 additions & 1 deletion packages/backend/server/src/modules/auth/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class AuthService {
exp: now + this.config.auth.accessTokenExpiresIn,
iss: this.config.serverId,
sub: user.id,
aud: user.name,
aud: 'https://affine.pro',
jti: randomUUID({
disableEntropyCache: true,
}),
Expand Down Expand Up @@ -100,6 +100,7 @@ export class AuthService {
iss: [this.config.serverId],
leeway: this.config.auth.leeway,
requiredSpecClaims: ['exp', 'iat', 'iss', 'sub'],
aud: ['https://affine.pro'],
})
).data as UserClaim;

Expand Down
2 changes: 1 addition & 1 deletion packages/backend/server/src/modules/auth/utils/jwt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const jwtEncode = async (
exp: now + (maxAge ?? config.auth.accessTokenExpiresIn),
iss: config.serverId,
sub: user.id,
aud: user.name,
aud: 'https://affine.pro',
jti: randomUUID({
disableEntropyCache: true,
}),
Expand Down
150 changes: 75 additions & 75 deletions packages/backend/server/src/schema.gql
Original file line number Diff line number Diff line change
Expand Up @@ -72,81 +72,6 @@ type RemoveAvatar {
success: Boolean!
}

type TokenType {
token: String!
refresh: String!
sessionToken: String
}

type SubscriptionPrice {
type: String!
plan: SubscriptionPlan!
currency: String!
amount: Int!
yearlyAmount: Int!
}

enum SubscriptionPlan {
Free
Pro
Team
Enterprise
SelfHosted
}

type UserSubscription {
id: String!
plan: SubscriptionPlan!
recurring: SubscriptionRecurring!
status: SubscriptionStatus!
start: DateTime!
end: DateTime!
trialStart: DateTime
trialEnd: DateTime
nextBillAt: DateTime
canceledAt: DateTime
createdAt: DateTime!
updatedAt: DateTime!
}

enum SubscriptionRecurring {
Monthly
Yearly
}

enum SubscriptionStatus {
Active
PastDue
Unpaid
Canceled
Incomplete
Paused
IncompleteExpired
Trialing
}

type UserInvoice {
id: String!
plan: SubscriptionPlan!
recurring: SubscriptionRecurring!
currency: String!
amount: Int!
status: InvoiceStatus!
reason: String!
lastPaymentError: String
link: String
createdAt: DateTime!
updatedAt: DateTime!
}

enum InvoiceStatus {
Draft
Open
Void
Paid
Uncollectible
}

type InviteUserType {
"""User name"""
name: String
Expand Down Expand Up @@ -242,6 +167,81 @@ type InvitationType {
invitee: UserType!
}

type TokenType {
token: String!
refresh: String!
sessionToken: String
}

type SubscriptionPrice {
type: String!
plan: SubscriptionPlan!
currency: String!
amount: Int!
yearlyAmount: Int!
}

enum SubscriptionPlan {
Free
Pro
Team
Enterprise
SelfHosted
}

type UserSubscription {
id: String!
plan: SubscriptionPlan!
recurring: SubscriptionRecurring!
status: SubscriptionStatus!
start: DateTime!
end: DateTime!
trialStart: DateTime
trialEnd: DateTime
nextBillAt: DateTime
canceledAt: DateTime
createdAt: DateTime!
updatedAt: DateTime!
}

enum SubscriptionRecurring {
Monthly
Yearly
}

enum SubscriptionStatus {
Active
PastDue
Unpaid
Canceled
Incomplete
Paused
IncompleteExpired
Trialing
}

type UserInvoice {
id: String!
plan: SubscriptionPlan!
recurring: SubscriptionRecurring!
currency: String!
amount: Int!
status: InvoiceStatus!
reason: String!
lastPaymentError: String
link: String
createdAt: DateTime!
updatedAt: DateTime!
}

enum InvoiceStatus {
Draft
Open
Void
Paid
Uncollectible
}

type DocHistoryType {
workspaceId: String!
id: String!
Expand Down

0 comments on commit fc9f86e

Please sign in to comment.