@@ -9,9 +9,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
} ) ;
10
10
} ;
11
11
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
12
- exports . FindMany = exports . Create = exports . findUnique = void 0 ;
12
+ exports . CreateListingSubsripton = exports . FindListingSuscribers = exports . FindMany = exports . Create = exports . findUnique = void 0 ;
13
13
const db_1 = require ( "../db" ) ;
14
- const findUnique = ( { userId, listingId } ) => __awaiter ( void 0 , void 0 , void 0 , function * ( ) {
14
+ const findUnique = ( userId ) => __awaiter ( void 0 , void 0 , void 0 , function * ( ) {
15
15
const notification = yield db_1 . prisma . subscription . findFirst ( {
16
16
where : {
17
17
userId,
@@ -20,7 +20,7 @@ const findUnique = ({ userId, listingId }) => __awaiter(void 0, void 0, void 0,
20
20
return notification ;
21
21
} ) ;
22
22
exports . findUnique = findUnique ;
23
- const Create = ( { userId, listingId } ) => __awaiter ( void 0 , void 0 , void 0 , function * ( ) {
23
+ const Create = ( userId ) => __awaiter ( void 0 , void 0 , void 0 , function * ( ) {
24
24
const subscription = yield db_1 . prisma . subscription . create ( {
25
25
data : {
26
26
userId,
@@ -34,3 +34,22 @@ const FindMany = () => __awaiter(void 0, void 0, void 0, function* () {
34
34
return subscribers ;
35
35
} ) ;
36
36
exports . FindMany = FindMany ;
37
+ const FindListingSuscribers = ( listingId ) => __awaiter ( void 0 , void 0 , void 0 , function * ( ) {
38
+ const subscribers = yield db_1 . prisma . listingNotifySubscription . findMany ( {
39
+ where : {
40
+ listingId
41
+ }
42
+ } ) ;
43
+ return subscribers ;
44
+ } ) ;
45
+ exports . FindListingSuscribers = FindListingSuscribers ;
46
+ const CreateListingSubsripton = ( { userId, listingId } ) => __awaiter ( void 0 , void 0 , void 0 , function * ( ) {
47
+ const listing_suscription = yield db_1 . prisma . listingNotifySubscription . create ( {
48
+ data : {
49
+ userId,
50
+ listingId
51
+ }
52
+ } ) ;
53
+ return listing_suscription ;
54
+ } ) ;
55
+ exports . CreateListingSubsripton = CreateListingSubsripton ;
0 commit comments