blob: 463cf4617fa619bbaab333356d6375152eddaeac (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
package it.niedermann.nextcloud.deck.persistence.sync.adapters.db.dao;
import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Query;
import androidx.room.Transaction;
import java.util.List;
import it.niedermann.nextcloud.deck.model.ocs.comment.DeckComment;
import it.niedermann.nextcloud.deck.model.ocs.comment.full.FullDeckComment;
@Dao
public interface CommentDao extends GenericDao<DeckComment> {
@Query("SELECT * FROM DeckComment where accountId = :accountId and id = :remoteId")
DeckComment getCommentByRemoteIdDirectly(long accountId, Long remoteId);
@Query("SELECT * FROM DeckComment where accountId = :accountId and localId = :id")
DeckComment getCommentByLocalIdDirectly(long accountId, Long id);
@Query("SELECT * FROM DeckComment WHERE accountId = :accountId and objectId = :localCardId " +
"and (status<>1 or id is null or lastModified <> lastModifiedLocal) order by localId asc")
List<DeckComment> getLocallyChangedCommentsByLocalCardIdDirectly(long accountId, long localCardId);
@Query("SELECT * FROM DeckComment WHERE accountId = :accountId and (status<>1 or id is null or lastModified <> lastModifiedLocal)")
List<DeckComment> getLocallyChangedCommentsDirectly(long accountId);
@Query("SELECT * FROM DeckComment WHERE accountId = :accountId and objectId = :localCardId")
List<DeckComment> getCommentsForLocalCardIdDirectly(long accountId, Long localCardId);
@Query("SELECT * FROM DeckComment where objectId = :localCardId")
List<DeckComment> getCommentByLocalCardIdDirectly(Long localCardId);
@Query("SELECT * FROM DeckComment where objectId = :localCardId order by creationDateTime desc")
LiveData<List<DeckComment>> getCommentByLocalCardId(Long localCardId);
@Transaction
@Query("SELECT * FROM DeckComment where objectId = :localCardId order by creationDateTime desc, localId desc")
LiveData<List<FullDeckComment>> getFullCommentByLocalCardId(Long localCardId);
@Query("SELECT id FROM DeckComment where localId = :localId")
Long getRemoteCommentIdForLocalIdDirectly(Long localId);
@Query("SELECT localId FROM DeckComment where id = :remoteId and accountId = :accountId")
Long getLocalCommentIdForRemoteIdDirectly(long accountId, Long remoteId);
}
|