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

Commit

Permalink
🚨 Organize TS imports
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Aug 4, 2020
1 parent b9e775f commit 582e8ef
Show file tree
Hide file tree
Showing 22 changed files with 39 additions and 110 deletions.
9 changes: 4 additions & 5 deletions src/controllers/admin/coupons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,22 @@ import { MISSING_FIELD } from "@staart/errors";
import { RESOURCE_CREATED, respond } from "@staart/messages";
import {
ClassMiddleware,
Middleware,
Get,
Delete,
Get,
Middleware,
Patch,
Put,
Controller,
Request,
Response,
} from "@staart/server";
import { Joi } from "@staart/validate";
import { authHandler, validator } from "../../_staart/helpers/middleware";
import {
deleteCouponForUser,
generateCouponForUser,
getAllCouponsForUser,
getCouponForUser,
updateCouponForUser,
deleteCouponForUser,
generateCouponForUser,
} from "../../_staart/rest/admin";

@ClassMiddleware(authHandler)
Expand Down
16 changes: 3 additions & 13 deletions src/controllers/admin/index.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
import { MISSING_FIELD } from "@staart/errors";
import {
ClassMiddleware,
Controller,
Get,
Put,
Middleware,
Request,
Response,
} from "@staart/server";
import { authHandler, validator } from "../../_staart/helpers/middleware";
import { Joi } from "@staart/validate";
import { ClassMiddleware, Get, Request, Response } from "@staart/server";
import { authHandler } from "../../_staart/helpers/middleware";
import {
getAllGroupForUser,
getAllUsersForUser,
getServerLogsForUser,
generateCouponForUser,
getPaymentEventsForUser,
getServerLogsForUser,
} from "../../_staart/rest/admin";

@ClassMiddleware(authHandler)
Expand Down
10 changes: 2 additions & 8 deletions src/controllers/auth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,7 @@ import {
RESOURCE_UPDATED,
respond,
} from "@staart/messages";
import {
Controller,
Middleware,
Post,
Request,
Response,
} from "@staart/server";
import { Middleware, Post, Request, Response } from "@staart/server";
import { Joi, joiValidate } from "@staart/validate";
import { verifyToken } from "../../_staart/helpers/jwt";
import {
Expand All @@ -26,11 +20,11 @@ import {
login,
login2FA,
register,
resendEmailVerificationWithToken,
sendPasswordReset,
updatePassword,
validateRefreshToken,
verifyEmail,
resendEmailVerificationWithToken,
} from "../../_staart/rest/auth";
import { addInvitationCredits } from "../../_staart/rest/user";

Expand Down
3 changes: 1 addition & 2 deletions src/controllers/organizations/_id/api-keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
} from "@staart/messages";
import {
ClassMiddleware,
Controller,
Delete,
Get,
Middleware,
Expand All @@ -18,8 +17,8 @@ import {
import { Joi, joiValidate } from "@staart/validate";
import { authHandler, validator } from "../../../_staart/helpers/middleware";
import {
localsToTokenOrKey,
groupUsernameToId,
localsToTokenOrKey,
} from "../../../_staart/helpers/utils";
import {
createApiKeyForUser,
Expand Down
11 changes: 2 additions & 9 deletions src/controllers/organizations/_id/billing.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
import {
ClassMiddleware,
Controller,
Get,
Patch,
Request,
Response,
} from "@staart/server";
import { ClassMiddleware, Get, Patch, Request, Response } from "@staart/server";
import { Joi, joiValidate } from "@staart/validate";
import { authHandler } from "../../../_staart/helpers/middleware";
import {
localsToTokenOrKey,
groupUsernameToId,
localsToTokenOrKey,
} from "../../../_staart/helpers/utils";
import {
getGroupBillingForUser,
Expand Down
4 changes: 1 addition & 3 deletions src/controllers/organizations/_id/domains.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import {
RESOURCE_CREATED,
RESOURCE_DELETED,
RESOURCE_SUCCESS,
RESOURCE_UPDATED,
respond,
} from "@staart/messages";
import {
ClassMiddleware,
Controller,
Delete,
Get,
Middleware,
Expand All @@ -20,8 +18,8 @@ import {
import { Joi, joiValidate } from "@staart/validate";
import { authHandler, validator } from "../../../_staart/helpers/middleware";
import {
localsToTokenOrKey,
groupUsernameToId,
localsToTokenOrKey,
} from "../../../_staart/helpers/utils";
import {
createDomainForUser,
Expand Down
13 changes: 2 additions & 11 deletions src/controllers/organizations/_id/index.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,23 @@
import { RESOURCE_DELETED, RESOURCE_UPDATED, respond } from "@staart/messages";
import {
RESOURCE_CREATED,
RESOURCE_DELETED,
RESOURCE_UPDATED,
respond,
} from "@staart/messages";
import {
ChildControllers,
ClassMiddleware,
Controller,
Delete,
Get,
Middleware,
Patch,
Put,
Request,
Response,
} from "@staart/server";
import { Joi, joiValidate } from "@staart/validate";
import { authHandler, validator } from "../../../_staart/helpers/middleware";
import {
localsToTokenOrKey,
groupUsernameToId,
localsToTokenOrKey,
} from "../../../_staart/helpers/utils";
import {
deleteGroupForUser,
getAllGroupDataForUser,
getGroupForUser,
newGroupForUser,
updateGroupForUser,
} from "../../../_staart/rest/group";

Expand Down
10 changes: 2 additions & 8 deletions src/controllers/organizations/_id/invoices.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
import {
ClassMiddleware,
Controller,
Get,
Request,
Response,
} from "@staart/server";
import { ClassMiddleware, Get, Request, Response } from "@staart/server";
import { Joi, joiValidate } from "@staart/validate";
import { authHandler } from "../../../_staart/helpers/middleware";
import {
localsToTokenOrKey,
groupUsernameToId,
localsToTokenOrKey,
} from "../../../_staart/helpers/utils";
import {
getGroupInvoiceForUser,
Expand Down
5 changes: 2 additions & 3 deletions src/controllers/organizations/_id/memberships.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { MembershipRole } from "@prisma/client";
import {
RESOURCE_CREATED,
RESOURCE_DELETED,
Expand All @@ -6,7 +7,6 @@ import {
} from "@staart/messages";
import {
ClassMiddleware,
Controller,
Delete,
Get,
Middleware,
Expand All @@ -18,8 +18,8 @@ import {
import { Joi, joiValidate } from "@staart/validate";
import { authHandler, validator } from "../../../_staart/helpers/middleware";
import {
localsToTokenOrKey,
groupUsernameToId,
localsToTokenOrKey,
} from "../../../_staart/helpers/utils";
import {
deleteGroupMembershipForUser,
Expand All @@ -28,7 +28,6 @@ import {
inviteMemberToGroup,
updateGroupMembershipForUser,
} from "../../../_staart/rest/group";
import { MembershipRole } from "@prisma/client";

@ClassMiddleware(authHandler)
export class GroupMembershipsController {
Expand Down
3 changes: 1 addition & 2 deletions src/controllers/organizations/_id/sources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
} from "@staart/messages";
import {
ClassMiddleware,
Controller,
Delete,
Get,
Patch,
Expand All @@ -17,8 +16,8 @@ import {
import { Joi, joiValidate } from "@staart/validate";
import { authHandler } from "../../../_staart/helpers/middleware";
import {
localsToTokenOrKey,
groupUsernameToId,
localsToTokenOrKey,
} from "../../../_staart/helpers/utils";
import {
createGroupSourceForUser,
Expand Down
3 changes: 1 addition & 2 deletions src/controllers/organizations/_id/subscriptions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { RESOURCE_CREATED, RESOURCE_UPDATED, respond } from "@staart/messages";
import {
ClassMiddleware,
Controller,
Get,
Patch,
Put,
Expand All @@ -11,8 +10,8 @@ import {
import { Joi, joiValidate } from "@staart/validate";
import { authHandler } from "../../../_staart/helpers/middleware";
import {
localsToTokenOrKey,
groupUsernameToId,
localsToTokenOrKey,
} from "../../../_staart/helpers/utils";
import {
createGroupSubscriptionForUser,
Expand Down
13 changes: 3 additions & 10 deletions src/controllers/organizations/_id/transactions.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
import {
ClassMiddleware,
Controller,
Get,
Request,
Response,
Put,
} from "@staart/server";
import { ClassMiddleware, Get, Put, Request, Response } from "@staart/server";
import { Joi, joiValidate } from "@staart/validate";
import { authHandler } from "../../../_staart/helpers/middleware";
import {
localsToTokenOrKey,
groupUsernameToId,
localsToTokenOrKey,
} from "../../../_staart/helpers/utils";
import {
applyCouponToGroupForUser,
getGroupTransactionForUser,
getGroupTransactionsForUser,
applyCouponToGroupForUser,
} from "../../../_staart/rest/group";

@ClassMiddleware(authHandler)
Expand Down
3 changes: 1 addition & 2 deletions src/controllers/organizations/_id/webhooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
} from "@staart/messages";
import {
ClassMiddleware,
Controller,
Delete,
Get,
Middleware,
Expand All @@ -18,8 +17,8 @@ import {
import { Joi, joiValidate } from "@staart/validate";
import { authHandler, validator } from "../../../_staart/helpers/middleware";
import {
localsToTokenOrKey,
groupUsernameToId,
localsToTokenOrKey,
} from "../../../_staart/helpers/utils";
import {
createWebhookForUser,
Expand Down
12 changes: 1 addition & 11 deletions src/controllers/organizations/index.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
import { RESOURCE_CREATED, respond } from "@staart/messages";
import {
RESOURCE_CREATED,
RESOURCE_DELETED,
RESOURCE_UPDATED,
respond,
} from "@staart/messages";
import {
ChildControllers,
ClassMiddleware,
Controller,
Delete,
Get,
Middleware,
Patch,
Put,
Request,
Response,
Expand Down
1 change: 0 additions & 1 deletion src/controllers/users/_id/access-tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
} from "@staart/messages";
import {
ClassMiddleware,
Controller,
Delete,
Get,
Middleware,
Expand Down
5 changes: 2 additions & 3 deletions src/controllers/users/_id/emails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
} from "@staart/messages";
import {
ClassMiddleware,
Controller,
Delete,
Get,
Post,
Expand All @@ -18,11 +17,11 @@ import { Joi, joiValidate } from "@staart/validate";
import { authHandler } from "../../../_staart/helpers/middleware";
import { userUsernameToId } from "../../../_staart/helpers/utils";
import {
getAllEmailsForUser,
addEmailToUserForUser,
deleteEmailFromUserForUser,
getAllEmailsForUser,
getEmailForUser,
resendEmailVerificationForUser,
deleteEmailFromUserForUser,
} from "../../../_staart/rest/user";

@ClassMiddleware(authHandler)
Expand Down
3 changes: 1 addition & 2 deletions src/controllers/users/_id/identities.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import {
RESOURCE_CREATED,
RESOURCE_DELETED,
RESOURCE_SUCCESS,
respond,
RESOURCE_CREATED,
} from "@staart/messages";
import {
ClassMiddleware,
Controller,
Delete,
Get,
Post,
Expand Down
2 changes: 0 additions & 2 deletions src/controllers/users/_id/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { RESOURCE_DELETED, RESOURCE_UPDATED, respond } from "@staart/messages";
import {
ChildControllers,
ClassMiddleware,
Controller,
Delete,
Get,
Middleware,
Expand Down
5 changes: 2 additions & 3 deletions src/controllers/users/_id/memberships.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { RESOURCE_DELETED, RESOURCE_UPDATED, respond } from "@staart/messages";
import {
ClassMiddleware,
Controller,
Delete,
Get,
Patch,
Expand All @@ -12,9 +11,9 @@ import { Joi, joiValidate } from "@staart/validate";
import { authHandler } from "../../../_staart/helpers/middleware";
import { userUsernameToId } from "../../../_staart/helpers/utils";
import {
getMembershipsForUser,
getMembershipDetailsForUser,
deleteMembershipForUser,
getMembershipDetailsForUser,
getMembershipsForUser,
updateMembershipForUser,
} from "../../../_staart/rest/user";

Expand Down
Loading

0 comments on commit 582e8ef

Please sign in to comment.