sustc icon indicating copy to clipboard operation
sustc copied to clipboard

[Danmu Service] What does the argument "long id" in method likeDanmu() refers to?

Open Ray0v0 opened this issue 3 years ago • 4 comments

Describe your question

/**
     * Likes a danmu.
     * If the user already liked the danmu, this operation will cancel the like status.
     * It is mandatory that the user shall watch the video first before he/she can like a danmu of it.
     *
     * @param auth the current user's authentication information
     * @param id   the danmu's id
     * @return the like state of the user to this danmu after this operation
     * @apiNote You may consider the following corner cases:
     * <ul>
     *   <li>{@code auth} is invalid, as stated in {@link io.sustc.service.UserService#deleteAccount(AuthInfo, long)}</li>
     *   <li>{@code id} is invalid (<= 0 or not found)</li>
     * </ul>
     * If any of the corner case happened, {@code false} shall be returned.
     */
    boolean likeDanmu(AuthInfo auth, long id);

What does "the danmu's id" means? Beaucase there is no attribute refers to "id" in the DTO class DanmuRecord. Does it means we should assign an id to each danmuRecord? Similarly, when users are registering, should we assign an mid to each of them? When videos is being posted, should we assign a bv to each of them?

Ray0v0 avatar Dec 04 '23 14:12 Ray0v0

@sses7757 we will add a danmu id in the record dto? can't tell if we've discussed it

hezean avatar Dec 04 '23 20:12 hezean

@Ray0v0 You shall assign a unique danmu ID for each danmu you import, like long sendDanmu(AuthInfo auth, String bv, String content, float time);. Likewise, as stated in long register(RegisterUserReq req);, you shall assign a unique user ID for each user you import or create. Overall, this is not a bug since we have List<Long> displayDanmu(String bv, float timeStart, float timeEnd, boolean filter); to query your danmu IDs.

sses7757 avatar Dec 05 '23 07:12 sses7757

@Ray0v0 You shall assign a unique danmu ID for each danmu you import, like long sendDanmu(AuthInfo auth, String bv, String content, float time);. Likewise, as stated in long register(RegisterUserReq req);, you shall assign a unique user ID for each user you import or create. Overall, this is not a bug since we have List<Long> displayDanmu(String bv, float timeStart, float timeEnd, boolean filter); to query your danmu IDs.

Hello reviewer. I would like to ask further what is the mid & bv format for those imported data? Or should our newly assigned mid & bv have consistenet format with them? Thanks.

dequeueing avatar Dec 15 '23 12:12 dequeueing

@dequeueing In general, the IDs have to be integers with at most 64bit size, and the BVs shall be strings starts with "BV" and only uses characters from [0-9], [a-Z] and [A-Z]. However, for simplicity, there is no length limitations for your generated BV code.

sses7757 avatar Dec 19 '23 01:12 sses7757