formatted
This commit is contained in:
parent
90c552a8f3
commit
06c8d9c66b
|
@ -2,10 +2,10 @@
|
|||
|
||||
Tech stack:
|
||||
|
||||
- pyjwt
|
||||
- redis
|
||||
- ariadne
|
||||
- starlette
|
||||
- pyjwt
|
||||
- redis
|
||||
- ariadne
|
||||
- starlette
|
||||
|
||||
# Local development
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
## Based on
|
||||
|
||||
* pyjwt
|
||||
* [ariadne](https://github.com/mirumee/ariadne)
|
||||
* [aioredis](https://github.com/aio-libs/aioredis)
|
||||
* [starlette](https://github.com/encode/starlette)、
|
||||
* sqlalchmy ORM
|
||||
- pyjwt
|
||||
- [ariadne](https://github.com/mirumee/ariadne)
|
||||
- [aioredis](https://github.com/aio-libs/aioredis)
|
||||
- [starlette](https://github.com/encode/starlette)、
|
||||
- sqlalchmy ORM
|
||||
|
||||
token is valid for one day, user can choose to logout, logout is revoke token
|
||||
|
|
|
@ -10,8 +10,8 @@ pipenv install -r requirements.txt
|
|||
|
||||
## Using
|
||||
|
||||
Put the unpacked mongodump to the `data` folder and operate with `pipenv shell && python`
|
||||
|
||||
Put the unpacked mongodump to the `data` folder and operate with
|
||||
`pipenv shell && python`
|
||||
|
||||
1. get old data jsons
|
||||
|
||||
|
@ -23,19 +23,16 @@ bson2json.json_tables() # creates all the needed data json from bson mongodump
|
|||
|
||||
2. migrate users
|
||||
|
||||
```py
|
||||
import json
|
||||
from migrations.users import migrate
|
||||
|
||||
data = json.loads(open('data/users.json').read())
|
||||
newdata = {}
|
||||
|
||||
for u in data:
|
||||
try:
|
||||
newdata[u['_id']] = migrate(u)
|
||||
except:
|
||||
print('FAIL!')
|
||||
print(u)
|
||||
|
||||
|
||||
```sh
|
||||
pipenv run python migrate.py users
|
||||
```
|
||||
Note: this will create db entries and it is not tolerant to existed unique email.
|
||||
|
||||
3. then topics and shouts
|
||||
|
||||
```sh
|
||||
pipenv run python migrate.py topics
|
||||
pipenv run python migrate.py shouts
|
||||
```
|
||||
|
||||
Now you got the *.dict.json files which contain all the data with old and new(!) ids.
|
|
@ -3,36 +3,36 @@ scalar DateTime
|
|||
################################### Payload
|
||||
|
||||
type Result {
|
||||
error: String
|
||||
error: String
|
||||
}
|
||||
|
||||
type AuthResult {
|
||||
error: String
|
||||
token: String
|
||||
user: User
|
||||
error: String
|
||||
token: String
|
||||
user: User
|
||||
}
|
||||
|
||||
type UserResult {
|
||||
error: String
|
||||
user: User
|
||||
error: String
|
||||
user: User
|
||||
}
|
||||
|
||||
type MessageResult {
|
||||
error: String
|
||||
message: Message
|
||||
error: String
|
||||
message: Message
|
||||
}
|
||||
|
||||
input ShoutInput {
|
||||
org_id: Int!
|
||||
slug: String!
|
||||
body: String!
|
||||
replyTo: String # another shout
|
||||
tags: [String] # actual values
|
||||
topics: [String] # topic-slugs
|
||||
title: String
|
||||
versionOf: String
|
||||
visibleForRoles: [String] # role ids are strings
|
||||
visibleForUsers: [Int]
|
||||
org_id: Int!
|
||||
slug: String!
|
||||
body: String!
|
||||
replyTo: String # another shout
|
||||
tags: [String] # actual values
|
||||
topics: [String] # topic-slugs
|
||||
title: String
|
||||
versionOf: String
|
||||
visibleForRoles: [String] # role ids are strings
|
||||
visibleForUsers: [Int]
|
||||
}
|
||||
|
||||
input ProfileInput {
|
||||
|
@ -42,33 +42,33 @@ input ProfileInput {
|
|||
}
|
||||
|
||||
type ShoutResult {
|
||||
error: String
|
||||
shout: Shout
|
||||
error: String
|
||||
shout: Shout
|
||||
}
|
||||
|
||||
################################### Mutation
|
||||
|
||||
type Mutation {
|
||||
# message
|
||||
createMessage(body: String!, replyTo: Int): MessageResult!
|
||||
updateMessage(id: Int!, body: String!): MessageResult!
|
||||
deleteMessage(messageId: Int!): Result!
|
||||
createMessage(body: String!, replyTo: Int): MessageResult!
|
||||
updateMessage(id: Int!, body: String!): MessageResult!
|
||||
deleteMessage(messageId: Int!): Result!
|
||||
|
||||
# auth
|
||||
confirmEmail(token: String!): AuthResult!
|
||||
requestPasswordReset(email: String!): Boolean!
|
||||
confirmPasswordReset(token: String!): Boolean!
|
||||
registerUser(email: String!, password: String!): AuthResult!
|
||||
registerUser(email: String!, password: String!): AuthResult!
|
||||
# updatePassword(password: String!, token: String!): Token!
|
||||
# invalidateAllTokens: Boolean!
|
||||
# invalidateTokenById(id: Int!): Boolean!
|
||||
# requestEmailConfirmation: User!
|
||||
|
||||
# shout
|
||||
createShout(input: ShoutInput!): ShoutResult!
|
||||
updateShout(input: ShoutInput!): ShoutResult!
|
||||
deleteShout(slug: String!): Result!
|
||||
rateShout(slug: String!, value: Int!): Result!
|
||||
createShout(input: ShoutInput!): ShoutResult!
|
||||
updateShout(input: ShoutInput!): ShoutResult!
|
||||
deleteShout(slug: String!): Result!
|
||||
rateShout(slug: String!, value: Int!): Result!
|
||||
|
||||
# user profile
|
||||
# rateUser(value: Int!): Result!
|
||||
|
@ -80,11 +80,11 @@ type Mutation {
|
|||
|
||||
type Query {
|
||||
# auth
|
||||
isEmailFree(email: String!): Result!
|
||||
signIn(email: String!, password: String!): AuthResult!
|
||||
signOut: Result!
|
||||
isEmailFree(email: String!): Result!
|
||||
signIn(email: String!, password: String!): AuthResult!
|
||||
signOut: Result!
|
||||
# user profile
|
||||
getCurrentUser: UserResult!
|
||||
getCurrentUser: UserResult!
|
||||
getUserById(id: Int!): UserResult!
|
||||
# getUserRating(shout: Int): Int!
|
||||
|
||||
|
@ -99,8 +99,8 @@ type Query {
|
|||
# shoutsByTime(time: DateTime): [Shout]!
|
||||
|
||||
# getOnlineUsers: [User!]!
|
||||
topAuthors: [User]!
|
||||
topShouts: [Shout]!
|
||||
topAuthors: [User]!
|
||||
topShouts: [Shout]!
|
||||
}
|
||||
|
||||
############################################ Subscription
|
||||
|
@ -215,7 +215,6 @@ type Topic {
|
|||
|
||||
# TODO: resolvers to add/remove topics from publication
|
||||
|
||||
|
||||
type Proposal {
|
||||
body: String!
|
||||
shout: Int!
|
||||
|
|
Loading…
Reference in New Issue
Block a user