-
Notifications
You must be signed in to change notification settings - Fork 1
High6 Document Archive #169
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ni får nog kolla över detta lite mer men en bra början
|
||
file_path: Mapped[str] = mapped_column(String, nullable=False) # Path or URL to the document file | ||
file_type: Mapped[str] = mapped_column(String(50)) # PDF, DOCX, etc. | ||
date_uploaded: Mapped[datetime] = mapped_column(default=datetime.now(timezone.utc)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
konstig datetime grej, kolla hur vi gör vanligtvis, borde också vara init = false
document_router = APIRouter() | ||
|
||
|
||
""" @document_router.post( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ta bort skräp
|
||
""" @document_router.post( | ||
"/", dependencies=[Permission.require("manage", "DocumentArchive")], response_model=DocumentOverview | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ta bort skräp
if len(name) > MAX_DOCUMENT_TITLE: | ||
raise HTTPException(400, detail="The file name is too long") | ||
|
||
file_path = Path(f"documents/{datetime.date(datetime.now(timezone.utc))}-{name.replace(' ', '-')}.pdf") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
file path känns jobbig
file_path = Path(f"documents/{datetime.date(datetime.now(timezone.utc))}-{name.replace(' ', '-')}.pdf") | ||
if file_path.is_file(): | ||
raise HTTPException(400, detail="Filename is equal to already existing file") | ||
if file.size == None or file.size > MAX_DOCUMENT_BYTES: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
måste vara två if statements innanför varandra annars krash
def remove_doc(db: Session, img_id: int): | ||
# img = db.query(Img_DB).filter(Img_DB.id == img_id).one_or_none() | ||
|
||
# if img == None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vad händer här?
"/", dependencies=[Permission.require("manage", "DocumentArchive")], response_model=DocumentOverview | ||
) | ||
def update_document(db: DB_dependency, data: DocumentUpdate): | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vad händer här?
"/", dependencies=[Permission.require("manage", "DocumentArchive")], status_code=status.HTTP_204_NO_CONTENT | ||
) | ||
def delete_user_access(db: DB_dependency, access_id: int): | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vad händer här?
No description provided.