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

Commit

Permalink
Merge pull request #201 from mgilangjanuar/staging
Browse files Browse the repository at this point in the history
hotfix: get payment details
  • Loading branch information
mgilangjanuar authored Jan 14, 2022
2 parents e0425f8 + bcca1da commit aaacd16
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
5 changes: 2 additions & 3 deletions server/src/api/v1/Files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import moment from 'moment'
import multer from 'multer'
import { Files as Model } from '../../model/entities/Files'
import { Usages } from '../../model/entities/Usages'
import { Redis } from '../../service/Cache'
import { TG_CREDS } from '../../utils/Constant'
import { buildSort, buildWhereQuery } from '../../utils/FilterQuery'
import { Endpoint } from '../base/Endpoint'
Expand All @@ -28,7 +27,7 @@ export class Files {
throw { status: 404, body: { error: 'Parent not found' } }
}

const [files, length] = await Redis.connect().getFromCacheFirst(`files:${req.user?.id || 'null'}:${JSON.stringify(req.query || {})}`, async () => await Model.createQueryBuilder('files')
const [files, length] = await Model.createQueryBuilder('files')
.where(shared && (parent?.sharing_options?.includes(req.user?.username) || parent?.sharing_options?.includes('*'))
? 'true' : shared
? ':user = any(files.sharing_options) and (files.parent_id is null or parent.sharing_options is null or cardinality(parent.sharing_options) = 0 or not :user = any(parent.sharing_options))'
Expand All @@ -39,7 +38,7 @@ export class Files {
.skip(Number(offset) || 0)
.take(Number(limit) || 10)
.orderBy(buildSort(sort as string, 'files.'))
.getManyAndCount(), 1)
.getManyAndCount()
return res.send({ files, length })
}

Expand Down
4 changes: 2 additions & 2 deletions server/src/api/v1/Users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ export class Users {

if (req.user.subscription_id) {
try {
paymentDetails = await Redis.connect().getFromCacheFirst(`paypal:subscription:${req.user.subscription_id}`, async () => await new PayPal().getSubscription(req.user.subscription_id), 21600)
paymentDetails = await Redis.connect().getFromCacheFirst(`paypal:subscription:${req.user.subscription_id}`, async () => await new PayPal().getSubscription(req.user.subscription_id), 3)
} catch (error) {
// ignore
}
}

if (req.user.midtrans_id) {
try {
midtransPaymentDetails = await Redis.connect().getFromCacheFirst(`midtrans:transaction:${req.user.midtrans_id}`, async () => await new Midtrans().getTransactionStatus(req.user.midtrans_id), 21600)
midtransPaymentDetails = await Redis.connect().getFromCacheFirst(`midtrans:transaction:${req.user.midtrans_id}`, async () => await new Midtrans().getTransactionStatus(req.user.midtrans_id), 3)
if (!midtransPaymentDetails?.transaction_status) {
midtransPaymentDetails = null
}
Expand Down
6 changes: 4 additions & 2 deletions web/src/pages/Login.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ArrowRightOutlined, CheckCircleTwoTone, LoginOutlined } from '@ant-design/icons'
import { ArrowRightOutlined, CheckCircleTwoTone, LoginOutlined, GlobalOutlined } from '@ant-design/icons'
import { Button, Card, Col, Collapse, Form, Input, Layout, notification, Row, Spin, Steps, Typography } from 'antd'
import CountryPhoneInput, { ConfigProvider } from 'antd-country-phone-input'
import { useForm } from 'antd/lib/form/Form'
Expand Down Expand Up @@ -203,7 +203,9 @@ const Login: React.FC<Props> = ({ me }) => {
<Row style={{ marginTop: '30px' }}>
<Col lg={{ span: 10, offset: 7 }} md={{ span: 14, offset: 5 }} span={22} offset={1}>
<Collapse>
<Collapse.Panel key="1" header="Data center region">
<Collapse.Panel key="1" showArrow={false} header={<Typography.Text>
<GlobalOutlined /> Data center region
</Typography.Text>}>
<Typography.Paragraph type="secondary" style={{ fontSize: '14px' }}>
This will affect your upload and download speed, choose the nearest datacenter region to you.
</Typography.Paragraph>
Expand Down

0 comments on commit aaacd16

Please sign in to comment.