@iveri/contracts 0.149.0 → 0.150.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/api/social/index.d.ts +1 -0
- package/dist/api/social/index.js +1 -0
- package/dist/api/social/social-limits.constant.d.ts +8 -0
- package/dist/api/social/social-limits.constant.js +8 -0
- package/dist/api/social/social-moderation.type.d.ts +6 -0
- package/dist/api/social/social-poll.type.d.ts +47 -0
- package/dist/api/social/social-poll.type.js +1 -0
- package/dist/api/social/social-post.type.d.ts +6 -0
- package/dist/api/social/social-refusal.enum.d.ts +8 -0
- package/dist/api/social/social-refusal.enum.js +8 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -322,6 +322,8 @@ Conduit's outbox.
|
|
|
322
322
|
`UniboxAgents` under `@iveri/contracts/unibox`, so the inbox picks agents by name.
|
|
323
323
|
- Version `0.139.0` adds a trainer's notes on a member: `GymTrainerNote`, `GymTrainerNotes`, `SaveGymTrainerNoteRequest`,
|
|
324
324
|
`GymMyTrainerNote` and the `GymRefusal` member `not-their-trainer` under `@iveri/contracts/gym`.
|
|
325
|
+
- Version `0.150.0` adds polls on Ezo posts under `@iveri/contracts/social`: `SocialPoll`, `CreateSocialPollRequest`, `VoteSocialPollRequest`,
|
|
326
|
+
`poll` on `SocialPost` and on creating one, `SocialCaseEvidencePoll` on a case's evidence, and the poll refusals.
|
|
325
327
|
- Version `0.149.0` lets a gym member choose their numbered place in a class: `placeChoice` / `placeColumns` on
|
|
326
328
|
`GymRoom`, `GymSession` and `PublicGymSession`, `spotNumber` on the booking requests, `MoveGymBookingPlaceRequest`,
|
|
327
329
|
`GymSessionPlaces`, `GymMyBooking.canChangePlace` and the `GymRefusal` member `place-taken`.
|
|
@@ -13,6 +13,7 @@ export * from './social-member-status.enum.js';
|
|
|
13
13
|
export * from './social-member.type.js';
|
|
14
14
|
export * from './social-moderation-reason.enum.js';
|
|
15
15
|
export * from './social-moderation.type.js';
|
|
16
|
+
export * from './social-poll.type.js';
|
|
16
17
|
export * from './social-post.type.js';
|
|
17
18
|
export * from './social-refusal.enum.js';
|
|
18
19
|
export * from './social-report-reason.enum.js';
|
package/dist/api/social/index.js
CHANGED
|
@@ -13,6 +13,7 @@ export * from './social-member-status.enum.js';
|
|
|
13
13
|
export * from './social-member.type.js';
|
|
14
14
|
export * from './social-moderation-reason.enum.js';
|
|
15
15
|
export * from './social-moderation.type.js';
|
|
16
|
+
export * from './social-poll.type.js';
|
|
16
17
|
export * from './social-post.type.js';
|
|
17
18
|
export * from './social-refusal.enum.js';
|
|
18
19
|
export * from './social-report-reason.enum.js';
|
|
@@ -17,6 +17,14 @@ export declare const SOCIAL_LIMITS: {
|
|
|
17
17
|
readonly VIDEO_BYTES_MAX: number;
|
|
18
18
|
/** A longer video is refused, never cut short. */
|
|
19
19
|
readonly VIDEO_SECONDS_MAX: 60;
|
|
20
|
+
readonly POLL_QUESTION_MAX: 140;
|
|
21
|
+
readonly POLL_OPTION_MAX: 80;
|
|
22
|
+
readonly POLL_OPTIONS_MIN: 2;
|
|
23
|
+
readonly POLL_OPTIONS_MAX: 4;
|
|
24
|
+
readonly POLL_HOURS_MIN: 1;
|
|
25
|
+
/** Seven days. */
|
|
26
|
+
readonly POLL_HOURS_MAX: 168;
|
|
27
|
+
readonly POLL_HOURS_DEFAULT: 24;
|
|
20
28
|
readonly MINIMUM_AGE: 16;
|
|
21
29
|
};
|
|
22
30
|
/** The characters a handle may use, in the form they are stored. */
|
|
@@ -17,6 +17,14 @@ export const SOCIAL_LIMITS = {
|
|
|
17
17
|
VIDEO_BYTES_MAX: 100 * 1024 * 1024,
|
|
18
18
|
/** A longer video is refused, never cut short. */
|
|
19
19
|
VIDEO_SECONDS_MAX: 60,
|
|
20
|
+
POLL_QUESTION_MAX: 140,
|
|
21
|
+
POLL_OPTION_MAX: 80,
|
|
22
|
+
POLL_OPTIONS_MIN: 2,
|
|
23
|
+
POLL_OPTIONS_MAX: 4,
|
|
24
|
+
POLL_HOURS_MIN: 1,
|
|
25
|
+
/** Seven days. */
|
|
26
|
+
POLL_HOURS_MAX: 168,
|
|
27
|
+
POLL_HOURS_DEFAULT: 24,
|
|
20
28
|
MINIMUM_AGE: 16,
|
|
21
29
|
};
|
|
22
30
|
/** The characters a handle may use, in the form they are stored. */
|
|
@@ -38,8 +38,14 @@ export interface SocialCaseEvidence {
|
|
|
38
38
|
imageUrls: string[];
|
|
39
39
|
/** A reported video's poster only. Playing it goes through `SocialCaseVideoView`, which is logged. */
|
|
40
40
|
videos: SocialCaseVideo[];
|
|
41
|
+
/** A reported post's poll, its question and answers. How anybody voted is not part of a case. */
|
|
42
|
+
poll: Nullable<SocialCaseEvidencePoll>;
|
|
41
43
|
createdAt: Nullable<IsoDateTime>;
|
|
42
44
|
}
|
|
45
|
+
export interface SocialCaseEvidencePoll {
|
|
46
|
+
question: string;
|
|
47
|
+
options: string[];
|
|
48
|
+
}
|
|
43
49
|
export interface SocialCaseVideo {
|
|
44
50
|
id: UUID;
|
|
45
51
|
state: SocialVideoState;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { IsoDateTime } from '../../type/iso-date-time.type.js';
|
|
2
|
+
import type { Nullable } from '../../type/nil.type.js';
|
|
3
|
+
import type { UUID } from '../../type/uuid.type.js';
|
|
4
|
+
/**
|
|
5
|
+
* One answer a poll offers.
|
|
6
|
+
*
|
|
7
|
+
* `voteCount` and `percent` are null while the viewer may not see results yet: before they have voted,
|
|
8
|
+
* while the poll is open, unless it is their own. `percent` is a whole number and the options of one poll
|
|
9
|
+
* add up to 100 (or all read 0 when nobody voted), so every client shows the same figures.
|
|
10
|
+
*/
|
|
11
|
+
export interface SocialPollOption {
|
|
12
|
+
id: UUID;
|
|
13
|
+
text: string;
|
|
14
|
+
voteCount: Nullable<number>;
|
|
15
|
+
percent: Nullable<number>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A question with two to four answers, attached to a post.
|
|
19
|
+
*
|
|
20
|
+
* A vote is anonymous to everybody, the author included, and final once cast. Nobody is ever told who
|
|
21
|
+
* voted for what; the author sees only the totals.
|
|
22
|
+
*/
|
|
23
|
+
export interface SocialPoll {
|
|
24
|
+
id: UUID;
|
|
25
|
+
question: string;
|
|
26
|
+
options: SocialPollOption[];
|
|
27
|
+
closesAt: IsoDateTime;
|
|
28
|
+
isClosed: boolean;
|
|
29
|
+
/** Null while results are hidden from this viewer, as on the options. */
|
|
30
|
+
totalVotes: Nullable<number>;
|
|
31
|
+
/** The option this viewer chose, or null. Only ever their own. */
|
|
32
|
+
viewerOptionId: Nullable<UUID>;
|
|
33
|
+
/** The poll is open, not the viewer's own, and they have not voted yet. */
|
|
34
|
+
canVote: boolean;
|
|
35
|
+
resultsVisible: boolean;
|
|
36
|
+
}
|
|
37
|
+
/** A poll as it is posted. It cannot be changed afterwards. */
|
|
38
|
+
export interface CreateSocialPollRequest {
|
|
39
|
+
question: string;
|
|
40
|
+
/** Two to four answers, each different from the others. */
|
|
41
|
+
options: string[];
|
|
42
|
+
/** How long it stays open, in whole hours. A day when left out. */
|
|
43
|
+
durationHours?: number;
|
|
44
|
+
}
|
|
45
|
+
export interface VoteSocialPollRequest {
|
|
46
|
+
optionId: UUID;
|
|
47
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -3,6 +3,7 @@ import type { Nullable } from '../../type/nil.type.js';
|
|
|
3
3
|
import type { UUID } from '../../type/uuid.type.js';
|
|
4
4
|
import type { SocialImage } from './social-image.type.js';
|
|
5
5
|
import type { SocialMemberCard } from './social-member.type.js';
|
|
6
|
+
import type { CreateSocialPollRequest, SocialPoll } from './social-poll.type.js';
|
|
6
7
|
import type { SocialVideo } from './social-video.type.js';
|
|
7
8
|
export interface SocialPost {
|
|
8
9
|
id: UUID;
|
|
@@ -11,6 +12,8 @@ export interface SocialPost {
|
|
|
11
12
|
images: SocialImage[];
|
|
12
13
|
/** A post carries photographs or one video, never both. */
|
|
13
14
|
video: Nullable<SocialVideo>;
|
|
15
|
+
/** A post with a poll carries no photograph or video. */
|
|
16
|
+
poll: Nullable<SocialPoll>;
|
|
14
17
|
commentsDisabled: boolean;
|
|
15
18
|
likeCount: number;
|
|
16
19
|
commentCount: number;
|
|
@@ -28,8 +31,11 @@ export interface CreateSocialPostMedia {
|
|
|
28
31
|
export interface CreateSocialPostRequest {
|
|
29
32
|
caption?: Nullable<string>;
|
|
30
33
|
media?: CreateSocialPostMedia[];
|
|
34
|
+
/** Words may go with a poll; photographs and a video may not. */
|
|
35
|
+
poll?: Nullable<CreateSocialPollRequest>;
|
|
31
36
|
commentsDisabled?: boolean;
|
|
32
37
|
}
|
|
38
|
+
/** A poll is fixed once posted, so an edit cannot reach it. */
|
|
33
39
|
export interface UpdateSocialPostRequest {
|
|
34
40
|
caption?: Nullable<string>;
|
|
35
41
|
commentsDisabled?: boolean;
|
|
@@ -28,6 +28,14 @@ export declare enum SocialRefusal {
|
|
|
28
28
|
/** A post carries photographs or one video, never both and never two videos. */
|
|
29
29
|
POST_MEDIA_MIXED = "post-media-mixed",
|
|
30
30
|
POST_EMPTY = "post-empty",
|
|
31
|
+
/** A post with a poll carries words at most, never a photograph or a video. */
|
|
32
|
+
POLL_WITH_MEDIA = "poll-with-media",
|
|
33
|
+
/** The poll has closed, so it takes no more votes. */
|
|
34
|
+
POLL_CLOSED = "poll-closed",
|
|
35
|
+
/** A vote is final: this member already chose another answer. */
|
|
36
|
+
POLL_ALREADY_VOTED = "poll-already-voted",
|
|
37
|
+
/** Nobody votes in their own poll. */
|
|
38
|
+
POLL_OWN = "poll-own",
|
|
31
39
|
COMMENTS_DISABLED = "comments-disabled",
|
|
32
40
|
CANNOT_FOLLOW_SELF = "cannot-follow-self",
|
|
33
41
|
CANNOT_MESSAGE = "cannot-message",
|
|
@@ -29,6 +29,14 @@ export var SocialRefusal;
|
|
|
29
29
|
/** A post carries photographs or one video, never both and never two videos. */
|
|
30
30
|
SocialRefusal["POST_MEDIA_MIXED"] = "post-media-mixed";
|
|
31
31
|
SocialRefusal["POST_EMPTY"] = "post-empty";
|
|
32
|
+
/** A post with a poll carries words at most, never a photograph or a video. */
|
|
33
|
+
SocialRefusal["POLL_WITH_MEDIA"] = "poll-with-media";
|
|
34
|
+
/** The poll has closed, so it takes no more votes. */
|
|
35
|
+
SocialRefusal["POLL_CLOSED"] = "poll-closed";
|
|
36
|
+
/** A vote is final: this member already chose another answer. */
|
|
37
|
+
SocialRefusal["POLL_ALREADY_VOTED"] = "poll-already-voted";
|
|
38
|
+
/** Nobody votes in their own poll. */
|
|
39
|
+
SocialRefusal["POLL_OWN"] = "poll-own";
|
|
32
40
|
SocialRefusal["COMMENTS_DISABLED"] = "comments-disabled";
|
|
33
41
|
SocialRefusal["CANNOT_FOLLOW_SELF"] = "cannot-follow-self";
|
|
34
42
|
SocialRefusal["CANNOT_MESSAGE"] = "cannot-message";
|