Skip to content

Commit

Permalink
Revert "[PB-2228]: feat/real time changes apn"
Browse files Browse the repository at this point in the history
  • Loading branch information
sg-gs authored Jul 3, 2024
1 parent 6591127 commit 5678c7d
Show file tree
Hide file tree
Showing 8 changed files with 129 additions and 507 deletions.
6 changes: 0 additions & 6 deletions .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,3 @@ STORJ_BRIDGE=http://network-api:6382
STRIPE_SK=sk_test_F3Ny2VGUnPga9FtyXkl7mzPc
STRIPE_SK_TEST=sk_test_R3Ny2VG7nPgeJFrtXdt8mrPc
SENDGRID_MODE_SANDBOX=false

# APN
APN_BUNDLE_ID=
APN_TEAM_ID=
APN_KEY_ID=
APN_SECRET=
9 changes: 1 addition & 8 deletions src/app/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import initLimit, { LimitModel } from './limit';
import initTier, { TierModel } from './tier';
import initPaidPlan, { PaidPlansModel } from './paidPlans';
import initTierLimit, { TierLimitsModel } from './tierLimit';
import initUserNotificationTokens, { UserNotificationTokenModel } from './userNotificationTokens';

export type ModelType =
| AppSumoModel
Expand Down Expand Up @@ -54,8 +53,7 @@ export type ModelType =
| PaidPlansModel
| TierLimitsModel
| LimitModel
| TierModel
| UserNotificationTokenModel;
| TierModel;

export default (database: Sequelize) => {
const AppSumo = initAppSumo(database);
Expand Down Expand Up @@ -84,7 +82,6 @@ export default (database: Sequelize) => {
const Tier = initTier(database);
const PaidPlans = initPaidPlan(database);
const TierLimit = initTierLimit(database);
const UserNotificationToken = initUserNotificationTokens(database);

AppSumo.belongsTo(User);

Expand Down Expand Up @@ -135,7 +132,6 @@ export default (database: Sequelize) => {
User.hasMany(PrivateSharingFolder, { foreignKey: 'shared_with', sourceKey: 'uuid' });
User.hasMany(Sharings, { foreignKey: 'owner_id', sourceKey: 'uuid' });
User.hasMany(Sharings, { foreignKey: 'shared_with', sourceKey: 'uuid' });
User.hasMany(UserNotificationToken, { foreignKey: 'userId', sourceKey: 'uuid' });

UserReferral.belongsTo(User, { foreignKey: 'user_id' });
UserReferral.belongsTo(Referral, { foreignKey: 'referral_id' });
Expand Down Expand Up @@ -174,8 +170,6 @@ export default (database: Sequelize) => {
as: 'tiers',
});

UserNotificationToken.belongsTo(User, { foreignKey: 'userId', targetKey: 'uuid' });

return {
[AppSumo.name]: AppSumo,
[Backup.name]: Backup,
Expand Down Expand Up @@ -203,6 +197,5 @@ export default (database: Sequelize) => {
[Limit.name]: Limit,
[PaidPlans.name]: PaidPlans,
[TierLimit.name]: TierLimit,
['userNotificationToken']: UserNotificationToken,
};
};
60 changes: 0 additions & 60 deletions src/app/models/userNotificationTokens.ts

This file was deleted.

12 changes: 7 additions & 5 deletions src/app/routes/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,13 @@ import * as ReCaptchaV3 from '../../lib/recaptcha';
import * as AnalyticsService from '../../lib/analytics/AnalyticsService';
import { AuthorizedUser } from './types';
import { default as Notifications } from '../../config/initializers/notifications';
import { default as Apn } from '../../config/initializers/apn';

const Logger = logger.getInstance();

export default (router: Router, service: any, App: any): Router => {
service.Analytics = AnalyticsService;
service.ReCaptcha = ReCaptchaV3;
service.Notifications = Notifications.getInstance();
service.Apn = Apn.getInstance();

AuthRoutes(router, service, App.config);
ActivationRoutes(router, service);
Expand Down Expand Up @@ -109,7 +107,7 @@ export default (router: Router, service: any, App: any): Router => {
if (!userData.root_folder_id) {
throw createHttpError(500, 'Account can not be initialized');
}

const user = {
email: userData.email,
bucket: userData.bucket,
Expand All @@ -123,9 +121,13 @@ export default (router: Router, service: any, App: any): Router => {
res.status(200).send({ user });
} catch (err) {
Logger.error(
`[AUTH/INITIALIZE] ERROR: ${(err as Error).message}, BODY ${JSON.stringify(req.body)}, STACK: ${
`[AUTH/INITIALIZE] ERROR: ${
(err as Error).message
}, BODY ${
JSON.stringify(req.body)
}, STACK: ${
(err as Error).stack
}`,
}`
);

return res.status(500).send({ error: 'Internal Server Error' });
Expand Down
Loading

0 comments on commit 5678c7d

Please sign in to comment.