feat(api): publisher flag on members and the publishers post policy

- the member DTO carries publisher
- POST /lists/{id}/members takes an optional publisher: absent leaves the flag
  of an existing member alone, true or false sets it
- PATCH /lists/{id}/members/{address} with {"publisher": bool}: 404 for a
  non-member, 400 when the field is missing
- the list PATCH accepts post_policy publishers; the validation message says so
- openapi updated
This commit is contained in:
tgiachi 2026-11-10 12:38:35 +01:00
commit 0bbfd43e30

View file

@ -20,7 +20,7 @@ components:
domain: {type: string}
title: {type: string}
address: {type: string}
post_policy: {type: string, enum: [members, moderated]}
post_policy: {type: string, enum: [members, moderated, publishers], description: "publishers: a newsletter, only members flagged publisher may post"}
join_policy: {type: string, enum: [open, closed]}
archive_policy: {type: string, enum: [public, private, off], description: "public: browsable on the web; private: API only (default); off: not stored"}
Message:
@ -52,6 +52,7 @@ components:
display_name: {type: string}
disabled: {type: boolean, description: Disabled after 3 hard bounces within 30 days; re-adding the member re-enables it}
bounce_count: {type: integer, description: Recent hard bounces (restarts at 1 when the last one is older than 30 days)}
publisher: {type: boolean, description: May post when the list's post_policy is publishers}
Held:
type: object
properties:
@ -142,7 +143,7 @@ paths:
type: object
properties:
title: {type: string, minLength: 1, maxLength: 200, description: A single line without control characters.}
post_policy: {type: string, enum: [members, moderated]}
post_policy: {type: string, enum: [members, moderated, publishers], description: "publishers: a newsletter, only members flagged publisher may post"}
join_policy: {type: string, enum: [open, closed]}
archive_policy: {type: string, enum: [public, private, off]}
responses:
@ -182,6 +183,7 @@ paths:
properties:
address: {type: string}
display_name: {type: string}
publisher: {type: boolean, description: "Absent: an existing member keeps its flag (a new one is not a publisher); true or false: set it"}
responses:
'201':
description: Created
@ -199,6 +201,21 @@ paths:
responses:
'204': {description: Removed}
'404': {$ref: '#/components/responses/Error'}
patch:
summary: Make a member a publisher or a plain subscriber
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [publisher]
properties:
publisher: {type: boolean}
responses:
'204': {description: Updated}
'400': {$ref: '#/components/responses/Error'}
'404': {$ref: '#/components/responses/Error'}
/lists/{id}/held:
parameters:
- {name: id, in: path, required: true, schema: {type: integer}}