Skip to content

Commit

Permalink
adding technologies functionality, routing, domains, databases,...
Browse files Browse the repository at this point in the history
  • Loading branch information
danilojezernik committed Aug 29, 2024
1 parent a5520c1 commit a1e5585
Show file tree
Hide file tree
Showing 27 changed files with 2,253 additions and 12 deletions.
21 changes: 17 additions & 4 deletions src/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,26 @@
from fastapi.middleware.cors import CORSMiddleware

from src import env
from src.domain.angular import Angular
# Import domain for output.txt
from src.domain.blog import Blog
from src.domain.book import Book
from src.domain.comments import Comment
from src.domain.contact import Contact
from src.domain.experiences import Experiences
from src.domain.javascript import JavaScript
from src.domain.links import Links
from src.domain.mongodb import MongoDb
from src.domain.newsletter import Newsletter
from src.domain.projects import Projects
from src.domain.python import Python
from src.domain.subscriber import Subscriber
from src.domain.technology import Technology
from src.domain.typescript import TypeScript
from src.domain.user import User
from src.domain.vue import Vue
# Imported routes
from src.routes import index, blog, email, login, user, experiences, links, register, contact, projects, newsletter, \
subscriber, comments, github, book, technology, media
subscriber, comments, github, book, media, angular, vue, typescript, javascript, mongodb, python
from src.services import db
from src.tags_metadata import tags_metadata
from src.utils.domain_to_txt import write_fields_to_txt
Expand All @@ -39,7 +44,15 @@
app.include_router(media.router, prefix='/media', tags=['Media'])
app.include_router(github.router, prefix='/github', tags=['Github'])
app.include_router(book.router, prefix='/book', tags=['Book'])
app.include_router(technology.router, prefix='/technology', tags=['Technology'])
# app.include_router(technology.router, prefix='/technology', tags=['Technology'])

# Technologies
app.include_router(angular.router, prefix='/angular', tags=['Angular'])
app.include_router(vue.router, prefix='/vue', tags=['Vue'])
app.include_router(javascript.router, prefix='/javascript', tags=['JavaScript'])
app.include_router(typescript.router, prefix='/typescript', tags=['TypeScript'])
app.include_router(python.router, prefix='/python', tags=['Python'])
app.include_router(mongodb.router, prefix='/mongodb', tags=['MongoDB'])

app.include_router(comments.router, prefix='/comments', tags=['Comment'])
app.include_router(experiences.router, prefix='/experiences', tags=['Experiences'])
Expand Down Expand Up @@ -79,7 +92,7 @@
if yes_doc == 'y':
print('Writing fields to output.txt...')
write_fields_to_txt(
[Blog, Experiences, Comment, Contact, Links, Newsletter, Projects, Subscriber, User, Book, Technology])
[Blog, Experiences, Comment, Contact, Links, Newsletter, Projects, Subscriber, User, Book, Angular, Vue, JavaScript, TypeScript, Python, MongoDb ])
print('Done! Fields have been written to output.txt')
else:
print('Document writing aborted')
Expand Down
24 changes: 24 additions & 0 deletions src/database/angular.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import datetime

from src.domain.angular import Angular

angular = [
Angular(
question='Angular questions 1',
answer='Angular je framework, ki ga dela Google in je zelo priljubljen.',
image='angular1.jpg',
datum_vnosa=datetime.datetime.now(),
).dict(by_alias=True),
Angular(
question='Angular questions 2',
answer='Angular je framework, ki ga dela Google in je zelo priljubljen.',
image='angular1.jpg',
datum_vnosa=datetime.datetime.now(),
).dict(by_alias=True),
Angular(
question='Angular questions 3',
answer='Angular je framework, ki ga dela Google in je zelo priljubljen.',
image='angular1.jpg',
datum_vnosa=datetime.datetime.now(),
).dict(by_alias=True)
]
3 changes: 3 additions & 0 deletions src/database/blog.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
title='Test Naslov 1',
kategorija='angular',
podnaslov='Test Podnaslov 1',
author='Danilo Jezernik',
datum_vnosa=datetime.datetime.now(),
vsebina='<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam dictum pellentesque ornare. Integer pulvinar, diam sed consequat pulvinar, justo tortor cursus metus, gravida tincidunt orci sapien vitae orci. Integer id facilisis erat, ac commodo urna. Sed congue ante aliquet magna tempor laoreet. Mauris vel nisl porta, venenatis quam id, consequat est. Praesent vulputate et ipsum a posuere. Vestibulum arcu magna, iaculis sit amet pharetra sodales, aliquet vitae elit. Aenean nec mi urna. Etiam sit amet laoreet quam. Aenean a risus quis diam consectetur volutpat. Nulla facilisi. Proin tempor accumsan risus, vitae vulputate diam aliquet a.</p><p>Quisque accumsan luctus elit vel tempus. Mauris at justo vestibulum, feugiat ipsum sit amet, sollicitudin nisl. Aliquam at tincidunt nunc. Vivamus quis lacinia leo, quis ornare justo. Proin elit nunc, mattis at fermentum a, rutrum eget turpis. Aenean posuere arcu vel ipsum eleifend, sed pharetra risus placerat. Donec sem sapien, mattis ut convallis eget, tincidunt a lacus. Pellentesque vel lectus eros. Vestibulum finibus fringilla ipsum vitae vehicula. Nulla aliquam eleifend bibendum. Donec vitae lacinia odio, a consequat velit. Morbi volutpat condimentum justo, nec tempor dui venenatis ac. Maecenas porttitor enim vel urna condimentum dignissim.</p><p>Suspendisse interdum mauris et ligula aliquet, at gravida nulla maximus. Sed augue arcu, interdum sit amet consectetur non, faucibus vel magna. Quisque ac ex justo. Praesent scelerisque nibh nec lacinia pulvinar. Nullam nisl est, consequat ut dolor at, placerat venenatis risus. Donec aliquet pulvinar ex, nec hendrerit justo pulvinar varius. Pellentesque eget mauris eu purus accumsan cursus eget vel lorem.</p><p>Morbi sed dolor malesuada justo iaculis varius. Donec maximus tempus scelerisque. Mauris in lacus varius, tristique lacus vel, ornare justo. Donec tincidunt, purus sed feugiat fringilla, massa purus suscipit purus, vitae blandit augue sem ut sapien. Nulla at lorem volutpat, rutrum lacus ut, bibendum ex. Interdum et malesuada fames ac ante ipsum primis in faucibus. Duis sagittis mi ut lacus tincidunt, varius venenatis diam congue. Nam blandit orci a nisi porttitor, eget euismod nulla varius. Sed venenatis arcu in scelerisque laoreet. Nam vitae placerat nunc. Phasellus rhoncus erat ut maximus maximus. Curabitur quis consectetur quam.</p><p>Aliquam tincidunt lectus in elit laoreet, ac pretium eros porttitor. Sed et mauris tincidunt, maximus ante sit amet, tristique erat. Maecenas non consectetur nibh, a tempus ipsum. Pellentesque quis nunc non nisi gravida fringilla sed ut quam. Praesent malesuada velit et pharetra placerat. Nam metus diam, vulputate ut venenatis sit amet, consectetur vitae enim. Mauris sed neque luctus, interdum lectus vitae, placerat ante. Vivamus sed ullamcorper tellus. Sed viverra felis metus, quis efficitur dui fermentum in. Pellentesque sed elit vel erat gravida vestibulum vestibulum eget lacus.</p><p>Etiam sed imperdiet tortor. Fusce porta quam lectus, vitae porta metus placerat vel. Vivamus quis porttitor dolor. Aenean sodales turpis ac nulla dictum, laoreet fermentum arcu hendrerit. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed pharetra elit quis sem blandit, eu ornare sem mollis. Phasellus eu bibendum est, ac cursus dui. Aenean vel dictum dolor, in condimentum turpis. In hac habitasse platea dictumst. Interdum et malesuada fames ac ante ipsum primis in faucibus. Sed aliquam scelerisque eros non congue. Nullam posuere urna ac diam iaculis varius.</p>',
image='test1.jpg'
Expand All @@ -15,6 +16,7 @@
title='Test Naslov 2',
kategorija='angular',
podnaslov='Test Podnaslov 2',
author='Danilo Jezernik',
datum_vnosa=datetime.datetime.now(),
vsebina='<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam dictum pellentesque ornare. Integer pulvinar, diam sed consequat pulvinar, justo tortor cursus metus, gravida tincidunt orci sapien vitae orci. Integer id facilisis erat, ac commodo urna. Sed congue ante aliquet magna tempor laoreet. Mauris vel nisl porta, venenatis quam id, consequat est. Praesent vulputate et ipsum a posuere. Vestibulum arcu magna, iaculis sit amet pharetra sodales, aliquet vitae elit. Aenean nec mi urna. Etiam sit amet laoreet quam. Aenean a risus quis diam consectetur volutpat. Nulla facilisi. Proin tempor accumsan risus, vitae vulputate diam aliquet a.</p><p>Quisque accumsan luctus elit vel tempus. Mauris at justo vestibulum, feugiat ipsum sit amet, sollicitudin nisl. Aliquam at tincidunt nunc. Vivamus quis lacinia leo, quis ornare justo. Proin elit nunc, mattis at fermentum a, rutrum eget turpis. Aenean posuere arcu vel ipsum eleifend, sed pharetra risus placerat. Donec sem sapien, mattis ut convallis eget, tincidunt a lacus. Pellentesque vel lectus eros. Vestibulum finibus fringilla ipsum vitae vehicula. Nulla aliquam eleifend bibendum. Donec vitae lacinia odio, a consequat velit. Morbi volutpat condimentum justo, nec tempor dui venenatis ac. Maecenas porttitor enim vel urna condimentum dignissim.</p><p>Suspendisse interdum mauris et ligula aliquet, at gravida nulla maximus. Sed augue arcu, interdum sit amet consectetur non, faucibus vel magna. Quisque ac ex justo. Praesent scelerisque nibh nec lacinia pulvinar. Nullam nisl est, consequat ut dolor at, placerat venenatis risus. Donec aliquet pulvinar ex, nec hendrerit justo pulvinar varius. Pellentesque eget mauris eu purus accumsan cursus eget vel lorem.</p><p>Morbi sed dolor malesuada justo iaculis varius. Donec maximus tempus scelerisque. Mauris in lacus varius, tristique lacus vel, ornare justo. Donec tincidunt, purus sed feugiat fringilla, massa purus suscipit purus, vitae blandit augue sem ut sapien. Nulla at lorem volutpat, rutrum lacus ut, bibendum ex. Interdum et malesuada fames ac ante ipsum primis in faucibus. Duis sagittis mi ut lacus tincidunt, varius venenatis diam congue. Nam blandit orci a nisi porttitor, eget euismod nulla varius. Sed venenatis arcu in scelerisque laoreet. Nam vitae placerat nunc. Phasellus rhoncus erat ut maximus maximus. Curabitur quis consectetur quam.</p><p>Aliquam tincidunt lectus in elit laoreet, ac pretium eros porttitor. Sed et mauris tincidunt, maximus ante sit amet, tristique erat. Maecenas non consectetur nibh, a tempus ipsum. Pellentesque quis nunc non nisi gravida fringilla sed ut quam. Praesent malesuada velit et pharetra placerat. Nam metus diam, vulputate ut venenatis sit amet, consectetur vitae enim. Mauris sed neque luctus, interdum lectus vitae, placerat ante. Vivamus sed ullamcorper tellus. Sed viverra felis metus, quis efficitur dui fermentum in. Pellentesque sed elit vel erat gravida vestibulum vestibulum eget lacus.</p><p>Etiam sed imperdiet tortor. Fusce porta quam lectus, vitae porta metus placerat vel. Vivamus quis porttitor dolor. Aenean sodales turpis ac nulla dictum, laoreet fermentum arcu hendrerit. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed pharetra elit quis sem blandit, eu ornare sem mollis. Phasellus eu bibendum est, ac cursus dui. Aenean vel dictum dolor, in condimentum turpis. In hac habitasse platea dictumst. Interdum et malesuada fames ac ante ipsum primis in faucibus. Sed aliquam scelerisque eros non congue. Nullam posuere urna ac diam iaculis varius.</p>',
image='test2.jpg'
Expand All @@ -23,6 +25,7 @@
title='Test Naslov 3',
kategorija='angular',
podnaslov='Test Podnaslov 3',
author='Danilo Jezernik',
datum_vnosa=datetime.datetime.now(),
vsebina='<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam dictum pellentesque ornare. Integer pulvinar, diam sed consequat pulvinar, justo tortor cursus metus, gravida tincidunt orci sapien vitae orci. Integer id facilisis erat, ac commodo urna. Sed congue ante aliquet magna tempor laoreet. Mauris vel nisl porta, venenatis quam id, consequat est. Praesent vulputate et ipsum a posuere. Vestibulum arcu magna, iaculis sit amet pharetra sodales, aliquet vitae elit. Aenean nec mi urna. Etiam sit amet laoreet quam. Aenean a risus quis diam consectetur volutpat. Nulla facilisi. Proin tempor accumsan risus, vitae vulputate diam aliquet a.</p><p>Quisque accumsan luctus elit vel tempus. Mauris at justo vestibulum, feugiat ipsum sit amet, sollicitudin nisl. Aliquam at tincidunt nunc. Vivamus quis lacinia leo, quis ornare justo. Proin elit nunc, mattis at fermentum a, rutrum eget turpis. Aenean posuere arcu vel ipsum eleifend, sed pharetra risus placerat. Donec sem sapien, mattis ut convallis eget, tincidunt a lacus. Pellentesque vel lectus eros. Vestibulum finibus fringilla ipsum vitae vehicula. Nulla aliquam eleifend bibendum. Donec vitae lacinia odio, a consequat velit. Morbi volutpat condimentum justo, nec tempor dui venenatis ac. Maecenas porttitor enim vel urna condimentum dignissim.</p><p>Suspendisse interdum mauris et ligula aliquet, at gravida nulla maximus. Sed augue arcu, interdum sit amet consectetur non, faucibus vel magna. Quisque ac ex justo. Praesent scelerisque nibh nec lacinia pulvinar. Nullam nisl est, consequat ut dolor at, placerat venenatis risus. Donec aliquet pulvinar ex, nec hendrerit justo pulvinar varius. Pellentesque eget mauris eu purus accumsan cursus eget vel lorem.</p><p>Morbi sed dolor malesuada justo iaculis varius. Donec maximus tempus scelerisque. Mauris in lacus varius, tristique lacus vel, ornare justo. Donec tincidunt, purus sed feugiat fringilla, massa purus suscipit purus, vitae blandit augue sem ut sapien. Nulla at lorem volutpat, rutrum lacus ut, bibendum ex. Interdum et malesuada fames ac ante ipsum primis in faucibus. Duis sagittis mi ut lacus tincidunt, varius venenatis diam congue. Nam blandit orci a nisi porttitor, eget euismod nulla varius. Sed venenatis arcu in scelerisque laoreet. Nam vitae placerat nunc. Phasellus rhoncus erat ut maximus maximus. Curabitur quis consectetur quam.</p><p>Aliquam tincidunt lectus in elit laoreet, ac pretium eros porttitor. Sed et mauris tincidunt, maximus ante sit amet, tristique erat. Maecenas non consectetur nibh, a tempus ipsum. Pellentesque quis nunc non nisi gravida fringilla sed ut quam. Praesent malesuada velit et pharetra placerat. Nam metus diam, vulputate ut venenatis sit amet, consectetur vitae enim. Mauris sed neque luctus, interdum lectus vitae, placerat ante. Vivamus sed ullamcorper tellus. Sed viverra felis metus, quis efficitur dui fermentum in. Pellentesque sed elit vel erat gravida vestibulum vestibulum eget lacus.</p><p>Etiam sed imperdiet tortor. Fusce porta quam lectus, vitae porta metus placerat vel. Vivamus quis porttitor dolor. Aenean sodales turpis ac nulla dictum, laoreet fermentum arcu hendrerit. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed pharetra elit quis sem blandit, eu ornare sem mollis. Phasellus eu bibendum est, ac cursus dui. Aenean vel dictum dolor, in condimentum turpis. In hac habitasse platea dictumst. Interdum et malesuada fames ac ante ipsum primis in faucibus. Sed aliquam scelerisque eros non congue. Nullam posuere urna ac diam iaculis varius.</p>',
image='test3.jpg'
Expand Down
6 changes: 6 additions & 0 deletions src/database/book.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
naslov='Test Knjiga 1',
tehnologija='TypeScript',
podnaslov='Test Podnaslov 1',
author= 'MAt Pat',
buy_url= 'https://www.amazon.com/',
datum_vnosa=datetime.datetime.now(),
vsebina='Test Vsebina 1',
image='test1.jpg'
Expand All @@ -15,6 +17,8 @@
naslov='Test Knjiga 2',
tehnologija='Angular',
podnaslov='Test Podnaslov 2',
author= 'MAt Pat',
buy_url= 'https://www.amazon.com/',
datum_vnosa=datetime.datetime.now(),
vsebina='Test Vsebina 2',
image='test2.jpg'
Expand All @@ -23,6 +27,8 @@
naslov='Test Knjiga 3',
tehnologija='Vue',
podnaslov='Test Podnaslov 3',
author= 'MAt Pat',
buy_url= 'https://www.amazon.com/',
datum_vnosa=datetime.datetime.now(),
vsebina='Test Vsebina 3',
image='test3.jpg'
Expand Down
24 changes: 24 additions & 0 deletions src/database/javascript.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import datetime

from src.domain.javascript import JavaScript

javascript = [
JavaScript(
question='JavaScript questions 1',
answer='JavaScript je framework, ki ga dela Google in je zelo priljubljen.',
image='javascript.jpg',
datum_vnosa=datetime.datetime.now(),
).dict(by_alias=True),
JavaScript(
question='JavaScript questions 2',
answer='JavaScript je framework, ki ga dela Google in je zelo priljubljen.',
image='javascript.jpg',
datum_vnosa=datetime.datetime.now(),
).dict(by_alias=True),
JavaScript(
question='JavaScript questions 3',
answer='JavaScript je framework, ki ga dela Google in je zelo priljubljen.',
image='javascript.jpg',
datum_vnosa=datetime.datetime.now(),
).dict(by_alias=True)
]
24 changes: 24 additions & 0 deletions src/database/mongodb.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import datetime

from src.domain.mongodb import MongoDb

mongodb = [
MongoDb(
question='MongoDb questions 1',
answer='MongoDb je framework, ki ga dela Google in je zelo priljubljen.',
image='mongodb.jpg',
datum_vnosa=datetime.datetime.now(),
).dict(by_alias=True),
MongoDb(
question='MongoDb questions 2',
answer='MongoDb je framework, ki ga dela Google in je zelo priljubljen.',
image='mongodb.jpg',
datum_vnosa=datetime.datetime.now(),
).dict(by_alias=True),
MongoDb(
question='MongoDb questions 3',
answer='MongoDb je framework, ki ga dela Google in je zelo priljubljen.',
image='mongodb.jpg',
datum_vnosa=datetime.datetime.now(),
).dict(by_alias=True)
]
24 changes: 24 additions & 0 deletions src/database/python.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import datetime

from src.domain.python import Python

python = [
Python(
question='Python questions 1',
answer='Python je framework, ki ga dela Google in je zelo priljubljen.',
image='python.jpg',
datum_vnosa=datetime.datetime.now(),
).dict(by_alias=True),
Python(
question='Python questions 2',
answer='Python je framework, ki ga dela Google in je zelo priljubljen.',
image='python.jpg',
datum_vnosa=datetime.datetime.now(),
).dict(by_alias=True),
Python(
question='Python questions 3',
answer='Python je framework, ki ga dela Google in je zelo priljubljen.',
image='python.jpg',
datum_vnosa=datetime.datetime.now(),
).dict(by_alias=True)
]
24 changes: 24 additions & 0 deletions src/database/typescript.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import datetime

from src.domain.typescript import TypeScript

typescript = [
TypeScript(
question='TypeScript questions 1',
answer='TypeScript je framework, ki ga dela Google in je zelo priljubljen.',
image='typescript.jpg',
datum_vnosa=datetime.datetime.now(),
).dict(by_alias=True),
TypeScript(
question='TypeScript questions 2',
answer='TypeScript je framework, ki ga dela Google in je zelo priljubljen.',
image='typescript.jpg',
datum_vnosa=datetime.datetime.now(),
).dict(by_alias=True),
TypeScript(
question='TypeScript questions 3',
answer='TypeScript je framework, ki ga dela Google in je zelo priljubljen.',
image='typescript.jpg',
datum_vnosa=datetime.datetime.now(),
).dict(by_alias=True)
]
24 changes: 24 additions & 0 deletions src/database/vue.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import datetime

from src.domain.vue import Vue

vue = [
Vue(
question='Vue questions 1',
answer='Vue je framework, ki ga dela Google in je zelo priljubljen.',
image='vue1.jpg',
datum_vnosa=datetime.datetime.now(),
).dict(by_alias=True),
Vue(
question='Vue questions 2',
answer='Vue je framework, ki ga dela Google in je zelo priljubljen.',
image='vue1.jpg',
datum_vnosa=datetime.datetime.now(),
).dict(by_alias=True),
Vue(
question='Vue questions 3',
answer='Vue je framework, ki ga dela Google in je zelo priljubljen.',
image='vue1.jpg',
datum_vnosa=datetime.datetime.now(),
).dict(by_alias=True)
]
13 changes: 13 additions & 0 deletions src/domain/angular.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import datetime
from typing import Optional

from bson import ObjectId
from pydantic import BaseModel, Field


class Angular(BaseModel):
id: Optional[str] = Field(alias='_id', default_factory=lambda: str(ObjectId()))
question: str
answer: str
image: str
datum_vnosa: datetime.datetime = Field(default_factory=datetime.datetime.now)
Loading

0 comments on commit a1e5585

Please sign in to comment.