Skip to content

Commit

Permalink
Dependencies updated
Browse files Browse the repository at this point in the history
  • Loading branch information
ineshbose committed Feb 16, 2022
1 parent 069219f commit 2a9e733
Show file tree
Hide file tree
Showing 13 changed files with 1,046 additions and 2,074 deletions.
8 changes: 4 additions & 4 deletions docs/package.json
Expand Up @@ -4,13 +4,13 @@
"main": "index.js",
"dependencies": {
"es6-template-string": "^1.2.0",
"ts-node": "^10.4.0",
"ts-node": "^10.5.0",
"typescript": "^4.5.4"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.9.1",
"@typescript-eslint/parser": "^5.9.1",
"eslint": "^8.6.0",
"@typescript-eslint/eslint-plugin": "^5.12.0",
"@typescript-eslint/parser": "^5.12.0",
"eslint": "^8.9.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.25.4",
Expand Down
2 changes: 1 addition & 1 deletion docs/pyproject.toml
Expand Up @@ -13,7 +13,7 @@ packages = [
# python = "^3.6"

mkdocs = "^1.2.3"
mkdocs-material = "^7.3.4"
mkdocs-material = "^8.1.11"
mkdocs-material-extensions = "^1.0.3"

[tool.poetry.dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -16,7 +16,7 @@
"test": "echo \"Error: no test specified\" && exit 1"
},
"devDependencies": {
"lint-staged": "^12.1.7",
"lint-staged": "^12.3.4",
"yorkie": "^2.0.0"
},
"gitHooks": {
Expand Down
185 changes: 98 additions & 87 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Expand Up @@ -13,7 +13,7 @@ portion-mate-src = { path = "./src", develop = true }
portion-mate-docs = { path = "./docs", develop = true }

[tool.poetry.dev-dependencies]
black = "^21.10b0"
black = "^22.1.0"

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down
2 changes: 1 addition & 1 deletion src/app/api/auth.ts
Expand Up @@ -25,7 +25,7 @@ export const addRefreshInterceptor = (callback?: Function) => {
return refreshToken().then(() => axiosInstance(error.config));
} else {
if (callback) {
callback();
return callback();
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/app/screens/Auth/RegisterForm.tsx
Expand Up @@ -4,6 +4,7 @@ import { RootAuthScreenProps } from '../../types/navigation';
import { useAppContext } from '../../contexts';
import AuthForm from './AuthForm';
import styles, { passwordAccessory } from './FormStyle';
import { FormError } from '../../types/api';

export default function RegisterForm({
navigation,
Expand All @@ -18,7 +19,7 @@ export default function RegisterForm({
const [confirmPassword, setConfirmPassword] = React.useState<string>('');
const [passwordVisible, setPasswordVisible] = React.useState<boolean>(false);
const [agreedTerms, setAgreedTerms] = React.useState<boolean>(false);
const [error, setError] = React.useState<any>();
const [error, setError] = React.useState<FormError | any>();

return (
<AuthForm>
Expand Down
3 changes: 2 additions & 1 deletion src/app/screens/BottomTab/SettingsPage.tsx
Expand Up @@ -28,6 +28,7 @@ import { useAppContext, useThemeContext } from '../../contexts';
import { deleteUser, updateUser } from '../../api/user';
import { RootTabScreenProps } from '../../types/navigation';
import { IconOptions } from '../../types';
import { FormError } from '../../types/api';
import { passwordAccessory } from '../Auth/FormStyle';

type SettingProps = PressableProps & {
Expand Down Expand Up @@ -90,7 +91,7 @@ export default function SettingsPage({
const [passwordVisibility, setPasswordVisibility] =
React.useState<boolean>(false);

const [error, setError] = React.useState<any>();
const [error, setError] = React.useState<FormError | any>();

const [warnModalVisibility, setWarnModalVisibility] =
React.useState<boolean>(false);
Expand Down
4 changes: 2 additions & 2 deletions src/app/types/api.ts
Expand Up @@ -26,7 +26,7 @@ export type PaginationData<T> = {
export type FetchData<T> = PaginationData<T> | T[];

export type CreateData<
T extends GenericModel | ModelID,
T extends GenericModel | ModelID = GenericModel,
R extends keyof T | string = 'name'
> = Partial<Omit<T, 'id' | R>> & {
[P in R]: R extends keyof T
Expand All @@ -36,7 +36,7 @@ export type CreateData<
: any;
};

export type UpdateData<T extends GenericModel> = Partial<T> & {
export type UpdateData<T extends GenericModel = GenericModel> = Partial<T> & {
id: T['id'];
};

Expand Down
52 changes: 26 additions & 26 deletions src/package.json
Expand Up @@ -17,47 +17,47 @@
"@babel/runtime": "^7.17.2",
"@eva-design/eva": "^2.1.1",
"@expo/vector-icons": "^12.0.0",
"@expo/webpack-config": "^0.16.16",
"@react-native-async-storage/async-storage": "^1.15.14",
"@react-navigation/bottom-tabs": "^6.0.5",
"@react-navigation/native": "^6.0.2",
"@react-navigation/native-stack": "^6.1.0",
"@expo/webpack-config": "^0.16.18",
"@react-native-async-storage/async-storage": "~1.15.0",
"@react-navigation/bottom-tabs": "^6.2.0",
"@react-navigation/native": "^6.0.8",
"@react-navigation/native-stack": "^6.5.0",
"@ui-kitten/components": "^5.1.1",
"axios": "^0.24.0",
"expo": "~43.0.0",
"axios": "^0.26.0",
"expo": "~44.0.6",
"expo-asset": "~8.4.3",
"expo-constants": "~12.1.2",
"expo-font": "~10.0.3",
"expo-linking": "~2.4.2",
"expo-splash-screen": "~0.13.3",
"expo-status-bar": "~1.1.0",
"expo-web-browser": "~10.0.3",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-native": "0.64.2",
"react-native-chart-kit": "^6.11.0",
"expo-constants": "~13.0.2",
"expo-font": "~10.0.5",
"expo-linking": "~3.0.0",
"expo-splash-screen": "~0.14.2",
"expo-status-bar": "~1.2.0",
"expo-web-browser": "~10.1.1",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-native": "0.67.2",
"react-native-chart-kit": "^6.12.0",
"react-native-dotenv": "^3.3.1",
"react-native-markdown-display": "^7.0.0-alpha.2",
"react-native-safe-area-context": "3.3.2",
"react-native-screens": "~3.8.0",
"react-native-screens": "~3.10.1",
"react-native-svg": "12.1.1",
"react-native-web": "0.17.1"
"react-native-web": "0.17.5"
},
"devDependencies": {
"@babel/core": "^7.12.9",
"@types/react": "~17.0.21",
"@types/react-native": "~0.64.12",
"@typescript-eslint/eslint-plugin": "^5.4.0",
"@typescript-eslint/parser": "^5.4.0",
"eslint": "^8.3.0",
"@babel/core": "^7.17.3",
"@types/react": "~17.0.39",
"@types/react-native": "~0.66.15",
"@typescript-eslint/eslint-plugin": "^5.12.0",
"@typescript-eslint/parser": "^5.12.0",
"eslint": "^8.9.0",
"eslint-config-airbnb-typescript": "^16.0.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.27.1",
"eslint-plugin-react-hooks": "^4.3.0",
"eslint-plugin-react-native": "^4.0.0",
"jest-expo": "~43.0.0",
"jest-expo": "~44.0.1",
"prettier": "^2.4.1",
"prettylint": "^1.0.0",
"react-test-renderer": "^17.0.2",
Expand Down
10 changes: 5 additions & 5 deletions src/pyproject.toml
Expand Up @@ -13,17 +13,17 @@ packages = [
# python = "^3.8"

Django = "^3.2"
django-cleanup = "^5.2.0"
django-cleanup = "^6.0.0"
django-environ = "^0.8.1"
djangorestframework = "^3.13.1"
Pillow = "^8.4.0"
django-oauth-toolkit = "^1.6.1"
django-cors-headers = "^3.10.1"
Pillow = "^9.0.1"
django-oauth-toolkit = "^1.7.0"
django-cors-headers = "^3.11.0"
graphene-django = "^2.15.0"
django-markdownx = "^3.0.1"

[tool.poetry.dev-dependencies]
black = "^21.10b0"
black = "^22.1.0"

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down
31 changes: 15 additions & 16 deletions src/server/rest/serializers.py
Expand Up @@ -37,6 +37,16 @@ def __init__(self, *args, **kwargs):
if field_name in self.fields:
self.fields.pop(field_name)

def get_auth_user(self, default=None, *args, **kwargs):
"""
Get an authenticated user, else None.
"""
return (
self.context["request"].user
if self.context.get("request") and hasattr(self.context["request"], "user")
else default
)


class UserSerializer(DynamicFieldsModelSerializer):
old_password = serializers.CharField(
Expand Down Expand Up @@ -133,13 +143,9 @@ class Meta:

def create(self, validated_data):
item = validated_data.pop("item")
validated_data["item"] = models.PortionItem.objects.get_or_create(**item)[0]

validated_data["user"] = (
self.context["request"].user
if self.context.get("request") and hasattr(self.context["request"], "user")
else False
)
validated_data["item"] = models.PortionItem.objects.get_or_create(**item)[0]
validated_data["user"] = self.get_auth_user()

return super().create(validated_data)

Expand All @@ -154,11 +160,8 @@ class ResourceSerializer(DynamicFieldsModelSerializer):
bookmarked = serializers.SerializerMethodField()

def get_bookmarked(self, obj):
return (
self.context["request"].user in obj.bookmarked_users.all()
if self.context.get("request") and hasattr(self.context["request"], "user")
else False
)
user = self.get_auth_user()
return user in obj.bookmarked_users.all() if user else False

class Meta:
model = models.Resource
Expand All @@ -180,9 +183,5 @@ class Meta:
extra_kwargs = {"user": {"write_only": True, "required": False}}

def create(self, validated_data):
validated_data["user"] = (
self.context["request"].user
if self.context.get("request") and hasattr(self.context["request"], "user")
else False
)
validated_data["user"] = self.get_auth_user()
return super().create(validated_data)

0 comments on commit 2a9e733

Please sign in to comment.