Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add frontend skeleton #13

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion flask_api/migrations/README

This file was deleted.

Empty file modified flask_api/migrations/alembic.ini
100755 → 100644
Empty file.
6 changes: 1 addition & 5 deletions flask_api/migrations/env.py
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

from __future__ import with_statement
from alembic import context
from sqlalchemy import engine_from_config, pool
Expand Down Expand Up @@ -27,15 +28,12 @@

def run_migrations_offline():
"""Run migrations in 'offline' mode.

This configures the context with just a URL
and not an Engine, though an Engine is acceptable
here as well. By skipping the Engine creation
we don't even need a DBAPI to be available.

Calls to context.execute() here emit the given string to the
script output.

"""
url = config.get_main_option("sqlalchemy.url")
context.configure(url=url)
Expand All @@ -46,10 +44,8 @@ def run_migrations_offline():

def run_migrations_online():
"""Run migrations in 'online' mode.

In this scenario we need to create an Engine
and associate a connection with the context.

"""
engine = engine_from_config(
config.get_section(config.config_ini_section),
Expand Down
Empty file modified flask_api/migrations/script.py.mako
100755 → 100644
Empty file.
31 changes: 31 additions & 0 deletions flask_api/migrations/versions/45b2cee6794_.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""empty message

Revision ID: 45b2cee6794
Revises: 51e2c29ad95
Create Date: 2020-04-20 21:37:39.054844

"""

# revision identifiers, used by Alembic.
revision = '45b2cee6794'
down_revision = '51e2c29ad95'

from alembic import op
import sqlalchemy as sa


def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_table('user')
### end Alembic commands ###


def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.create_table('user',
sa.Column('first_name', sa.VARCHAR(length=300), autoincrement=False, nullable=False),
sa.Column('last_name', sa.VARCHAR(length=300), autoincrement=False, nullable=False),
sa.Column('age', sa.INTEGER(), autoincrement=False, nullable=True),
sa.PrimaryKeyConstraint('first_name', 'last_name', name='user_pkey')
)
### end Alembic commands ###
26 changes: 26 additions & 0 deletions flask_api/migrations/versions/5050cf3151a_.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""empty message

Revision ID: 5050cf3151a
Revises: 45b2cee6794
Create Date: 2020-04-20 21:44:08.028027

"""

# revision identifiers, used by Alembic.
revision = '5050cf3151a'
down_revision = '45b2cee6794'

from alembic import op
import sqlalchemy as sa


def upgrade():
### commands auto generated by Alembic - please adjust! ###
pass
### end Alembic commands ###


def downgrade():
### commands auto generated by Alembic - please adjust! ###
pass
### end Alembic commands ###
8 changes: 6 additions & 2 deletions flask_api/migrations/versions/51e2c29ad95_.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@
def upgrade():
op.create_table(
'user',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('first_name', sa.String(length=300), nullable=False),
sa.Column('last_name', sa.String(length=300), nullable=False),
sa.Column('age', sa.Integer(), nullable=True),
sa.PrimaryKeyConstraint('first_name', 'last_name')
sa.Column('email', sa.String(length=300), nullable=False),
sa.Column('password', sa.String(length=300), nullable=False),
sa.Column('created_at', sa.String(length=300), nullable=False),
sa.Column('modified_at', sa.Integer(), nullable=False),
sa.PrimaryKeyConstraint('id')
)


Expand Down
2 changes: 1 addition & 1 deletion flask_api/src/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
DB_CONTAINER = os.getenv('APPLICATION_DB_CONTAINER', 'db')
POSTGRES = {
'user': os.getenv('APPLICATION_POSTGRES_USER', 'postgres'),
'pw': os.getenv('APPLICATION_POSTGRES_PW', ''),
'pw': os.getenv('APPLICATION_POSTGRES_PW', 'pass123'),
'host': os.getenv('APPLICATION_POSTGRES_HOST', DB_CONTAINER),
'port': os.getenv('APPLICATION_POSTGRES_PORT', 5432),
'db': os.getenv('APPLICATION_POSTGRES_DB', 'postgres'),
Expand Down
28 changes: 18 additions & 10 deletions flask_api/src/models/podcast_episode.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,29 @@
"""
from . import db
from .abc import BaseModel

import datetime

class PodcastEpisode(db.Model, BaseModel):
""" The podcast Episode model """
__tablename__ = 'PodcastEpisode'

#TODO
id = db.Column(db.Integer, primary_key=True)
episode_name = db.Column(db.String(300), nullable=False)
description = db.Column(db.String(300), nullable=True)
show_id = db.Column(db.Integer, db.ForeignKey('PodcastShow.id'), nullable=False)
created_at = db.Column(db.DateTime)
modified_at = db.Column(db.DateTime)
ad_timestamps = db.Column(db.ARRAY(db.Integer), nullable= True)
highlights_timestamps = db.Column(db.ARRAY(db.Integer), nullable= True)

first_name = db.Column(db.String(300), primary_key=True)
last_name = db.Column(db.String(300), primary_key=True)
# The age of our user
age = db.Column(db.Integer, nullable=True)

def __init__(self, first_name, last_name, age=None):
def __init__(self, id, episode_name, description=None, show_id, created_at, modified_at, ad_timestamps=None, highlights_timestamps=None):
""" Create a new User """
self.first_name = first_name
self.last_name = last_name
self.age = age
self.id = id
self.episode_name = episode_name
self.description = description
self.show_id = show_id
self.created_at = datetime.datetime.utcnow()
self.modified_at = datetime.datetime.utcnow()
self.ad_timestamps = ad_timestamps
self.highlights_timestamps = highlights_timestamps
23 changes: 12 additions & 11 deletions flask_api/src/models/podcast_show.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@
class PodcastShow(db.Model, BaseModel):
""" The PodcastShow model """
__tablename__ = 'PodcastShow'

## TODO

first_name = db.Column(db.String(300), primary_key=True)
last_name = db.Column(db.String(300), primary_key=True)
# The age of our user
age = db.Column(db.Integer, nullable=True)

def __init__(self, first_name, last_name, age=None):
id = db.Column(db.Integer, primary_key=True)
show_name = db.Column(db.String(300), unique=True)
author = db.Column(db.String(300), nullable=True)
description = db.Column(db.String(300), nullable=True)
episodes = db.relationship('podcast_episode', backref='PodcastShow', lazy=True)

def __init__(self, id, show_name, author, description=None,episodes=None):
""" Create a new User """
self.first_name = first_name
self.last_name = last_name
self.age = age
self.id = id
self.show_name = show_name
self.author = author
self.description = description
self.episodes = episodes
22 changes: 16 additions & 6 deletions flask_api/src/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,29 @@
"""
from . import db
from .abc import BaseModel
import datetime


class User(db.Model, BaseModel):
""" The User model """
__tablename__ = 'user'

first_name = db.Column(db.String(300), primary_key=True)
last_name = db.Column(db.String(300), primary_key=True)
# The age of our user
age = db.Column(db.Integer, nullable=True)
id = db.Column(db.Integer,primary_key=True)
first_name = db.Column(db.String(300))
last_name = db.Column(db.String(300))
email = db.Column(db.String(300), unique=True, nullable=False)
password = db.Column(db.String(300), nullable=False)
created_at = db.Column(db.DateTime)
modified_at = db.Column(db.DateTime)
subscriptions = db.relationship('podcast_show', backref='user', lazy=True)

def __init__(self, first_name, last_name, age=None):
def __init__(self, id, first_name, last_name, email, password, created_at, modified_at, subscriptions=None):
""" Create a new User """
self.id = id
self.first_name = first_name
self.last_name = last_name
self.age = age
self.email = email
self.password = password
self.created_at = datetime.datetime.utcnow()
self.modified_at = datetime.datetime.utcnow()
self.subscriptions = subscriptions
23 changes: 23 additions & 0 deletions react-fe/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
68 changes: 68 additions & 0 deletions react-fe/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Available Scripts

In the project directory, you can run:

### `yarn start`

Runs the app in the development mode.<br />
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.<br />
You will also see any lint errors in the console.

### `yarn test`

Launches the test runner in the interactive watch mode.<br />
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `yarn build`

Builds the app for production to the `build` folder.<br />
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.<br />
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `yarn eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).

### Code Splitting

This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting

### Analyzing the Bundle Size

This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size

### Making a Progressive Web App

This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app

### Advanced Configuration

This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration

### Deployment

This section has moved here: https://facebook.github.io/create-react-app/docs/deployment

### `yarn build` fails to minify

This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
Loading