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

api for post upload #888

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

api for post upload #888

wants to merge 12 commits into from

Conversation

krmax44
Copy link
Member

@krmax44 krmax44 commented Nov 11, 2024

notable changes:

ts client example:

import { retrieveFoiMessage } from './api/index.ts'

retrieveFoiMessage({
  path: { id: '22699' }
}).then((response) => {
  console.log(response.data?.kind) // "email" | "post" | "fax" | "upload" | "phone" | "visit" | "import" | undefined
})

@krmax44 krmax44 force-pushed the krmax44/post-upload-api branch 5 times, most recently from a4aa599 to d7df699 Compare November 11, 2024 16:23
@krmax44 krmax44 force-pushed the krmax44/post-upload-api branch 6 times, most recently from d6e3dc4 to e9bbc04 Compare November 18, 2024 16:02
@krmax44 krmax44 marked this pull request as ready for review November 18, 2024 16:03
@krmax44 krmax44 requested review from pajowu, stefanw and bikubi and removed request for pajowu November 18, 2024 16:03
froide/foirequest/admin.py Outdated Show resolved Hide resolved
froide/foirequest/admin.py Outdated Show resolved Hide resolved
froide/foirequest/api/permissions.py Outdated Show resolved Hide resolved
froide/foirequest/api/permissions.py Outdated Show resolved Hide resolved
froide/foirequest/models/message.py Show resolved Hide resolved
froide/foirequest/api/serializers.py Outdated Show resolved Hide resolved
froide/foirequest/models/message.py Outdated Show resolved Hide resolved
froide/foirequest/models/message.py Outdated Show resolved Hide resolved
froide/foirequestfollower/api_views.py Outdated Show resolved Hide resolved
froide/georegion/api_views.py Outdated Show resolved Hide resolved
froide/foirequest/api/permissions.py Outdated Show resolved Hide resolved
froide/foirequest/api/serializers.py Outdated Show resolved Hide resolved
froide/foirequest/api/views/message.py Outdated Show resolved Hide resolved
froide/foirequest/api/serializers.py Outdated Show resolved Hide resolved
froide/foirequest/api/serializers.py Outdated Show resolved Hide resolved
froide/foirequest/api/views/attachment.py Outdated Show resolved Hide resolved
froide/foirequest/api/views/message.py Outdated Show resolved Hide resolved
froide/foirequest/models/message.py Outdated Show resolved Hide resolved
froide/settings.py Show resolved Hide resolved
@krmax44 krmax44 force-pushed the krmax44/post-upload-api branch from e9bbc04 to d4df778 Compare November 22, 2024 10:52
@krmax44 krmax44 force-pushed the krmax44/post-upload-api branch 3 times, most recently from eab4414 to b5e31e9 Compare December 6, 2024 15:40
@krmax44 krmax44 force-pushed the krmax44/post-upload-api branch 2 times, most recently from e9b2bdb to f00b8e1 Compare December 9, 2024 16:32
@krmax44
Copy link
Member Author

krmax44 commented Dec 9, 2024

I've split up models and views by FoiRequestMessage and FoiRequestDraftMessage (with endpoints api/v1/message and api/v1/message/draft). While this also reduces the risk of leaking drafts, in the request's detail page the message attribute will now no longer list drafts. If that is undesirable, we'd need to update this function:

def get_messages(self, obj):
qs = optimize_message_queryset(
self.context["request"], FoiMessage.objects.filter(request=obj)
)
return FoiMessageSerializer(
qs, read_only=True, many=True, context=self.context
).data

@krmax44 krmax44 force-pushed the krmax44/post-upload-api branch from f00b8e1 to 11d17c4 Compare December 13, 2024 09:49
@krmax44 krmax44 force-pushed the krmax44/post-upload-api branch from 11d17c4 to dc2cd58 Compare December 13, 2024 10:06
@krmax44 krmax44 requested review from pajowu and stefanw December 13, 2024 10:07
@krmax44 krmax44 force-pushed the krmax44/post-upload-api branch from 7a04422 to d23a17e Compare December 16, 2024 16:11
@krmax44 krmax44 force-pushed the krmax44/post-upload-api branch from d23a17e to 7c7e499 Compare December 16, 2024 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants