@openora/core 0.4.1-canary.67 → 0.4.1-canary.69

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.
Files changed (81) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/audit/__tests__/audit.service.int.test.js +80 -0
  3. package/dist/audit/__tests__/audit.service.int.test.js.map +1 -1
  4. package/dist/audit/plugin.d.ts.map +1 -1
  5. package/dist/audit/plugin.js +50 -4
  6. package/dist/audit/plugin.js.map +1 -1
  7. package/dist/contracts/schemas/events.d.ts +17 -0
  8. package/dist/contracts/schemas/events.d.ts.map +1 -1
  9. package/dist/contracts/schemas/events.js +19 -0
  10. package/dist/contracts/schemas/events.js.map +1 -1
  11. package/dist/engagement/contracts.d.ts +1 -0
  12. package/dist/engagement/contracts.d.ts.map +1 -1
  13. package/dist/engagement/contracts.js +1 -0
  14. package/dist/engagement/contracts.js.map +1 -1
  15. package/dist/engagement/index.d.ts +1 -0
  16. package/dist/engagement/index.d.ts.map +1 -1
  17. package/dist/engagement/index.js +1 -0
  18. package/dist/engagement/index.js.map +1 -1
  19. package/dist/engagement/notifications/__tests__/notifications.service.int.test.js +34 -0
  20. package/dist/engagement/notifications/__tests__/notifications.service.int.test.js.map +1 -1
  21. package/dist/engagement/notifications/contract/index.d.ts +9 -1
  22. package/dist/engagement/notifications/contract/index.d.ts.map +1 -1
  23. package/dist/engagement/notifications/contract/index.js +2 -0
  24. package/dist/engagement/notifications/contract/index.js.map +1 -1
  25. package/dist/engagement/notifications/plugin.d.ts.map +1 -1
  26. package/dist/engagement/notifications/plugin.js +24 -0
  27. package/dist/engagement/notifications/plugin.js.map +1 -1
  28. package/dist/engagement/notifications/router/index.d.ts +2 -0
  29. package/dist/engagement/notifications/router/index.d.ts.map +1 -1
  30. package/dist/engagement/server.d.ts +1 -0
  31. package/dist/engagement/server.d.ts.map +1 -1
  32. package/dist/engagement/server.js +1 -0
  33. package/dist/engagement/server.js.map +1 -1
  34. package/dist/engagement/social/__tests__/social.router.int.test.d.ts +2 -0
  35. package/dist/engagement/social/__tests__/social.router.int.test.d.ts.map +1 -0
  36. package/dist/engagement/social/__tests__/social.router.int.test.js +97 -0
  37. package/dist/engagement/social/__tests__/social.router.int.test.js.map +1 -0
  38. package/dist/engagement/social/__tests__/social.service.int.test.d.ts +2 -0
  39. package/dist/engagement/social/__tests__/social.service.int.test.d.ts.map +1 -0
  40. package/dist/engagement/social/__tests__/social.service.int.test.js +233 -0
  41. package/dist/engagement/social/__tests__/social.service.int.test.js.map +1 -0
  42. package/dist/engagement/social/contract/index.d.ts +73 -0
  43. package/dist/engagement/social/contract/index.d.ts.map +1 -0
  44. package/dist/engagement/social/contract/index.js +54 -0
  45. package/dist/engagement/social/contract/index.js.map +1 -0
  46. package/dist/engagement/social/drizzle/migrations/0000_fine_jamie_braddock.sql +24 -0
  47. package/dist/engagement/social/drizzle/migrations/0001_lame_eddie_brock.sql +10 -0
  48. package/dist/engagement/social/drizzle/migrations/0002_foamy_saracen.sql +1 -0
  49. package/dist/engagement/social/drizzle/migrations/meta/0000_snapshot.json +232 -0
  50. package/dist/engagement/social/drizzle/migrations/meta/0001_snapshot.json +129 -0
  51. package/dist/engagement/social/drizzle/migrations/meta/0002_snapshot.json +134 -0
  52. package/dist/engagement/social/drizzle/migrations/meta/_journal.json +27 -0
  53. package/dist/engagement/social/drizzle.config.d.ts +4 -0
  54. package/dist/engagement/social/drizzle.config.d.ts.map +1 -0
  55. package/dist/engagement/social/drizzle.config.js +21 -0
  56. package/dist/engagement/social/drizzle.config.js.map +1 -0
  57. package/dist/engagement/social/index.d.ts +3 -0
  58. package/dist/engagement/social/index.d.ts.map +1 -0
  59. package/dist/engagement/social/index.js +6 -0
  60. package/dist/engagement/social/index.js.map +1 -0
  61. package/dist/engagement/social/migrate.d.ts +5 -0
  62. package/dist/engagement/social/migrate.d.ts.map +1 -0
  63. package/dist/engagement/social/migrate.js +17 -0
  64. package/dist/engagement/social/migrate.js.map +1 -0
  65. package/dist/engagement/social/plugin.d.ts +111 -0
  66. package/dist/engagement/social/plugin.d.ts.map +1 -0
  67. package/dist/engagement/social/plugin.js +16 -0
  68. package/dist/engagement/social/plugin.js.map +1 -0
  69. package/dist/engagement/social/router/index.d.ts +31 -0
  70. package/dist/engagement/social/router/index.d.ts.map +1 -0
  71. package/dist/engagement/social/router/index.js +31 -0
  72. package/dist/engagement/social/router/index.js.map +1 -0
  73. package/dist/engagement/social/schema/index.d.ts +128 -0
  74. package/dist/engagement/social/schema/index.d.ts.map +1 -0
  75. package/dist/engagement/social/schema/index.js +36 -0
  76. package/dist/engagement/social/schema/index.js.map +1 -0
  77. package/dist/engagement/social/service/social.service.d.ts +39 -0
  78. package/dist/engagement/social/service/social.service.d.ts.map +1 -0
  79. package/dist/engagement/social/service/social.service.js +251 -0
  80. package/dist/engagement/social/service/social.service.js.map +1 -0
  81. package/package.json +21 -1
@@ -0,0 +1,73 @@
1
+ import * as z from 'zod';
2
+ export declare const SendFriendRequestInputSchema: z.ZodObject<{
3
+ targetUserId: z.ZodUUID;
4
+ }, z.core.$strip>;
5
+ export type SendFriendRequestInput = z.infer<typeof SendFriendRequestInputSchema>;
6
+ export declare const FriendshipSchema: z.ZodObject<{
7
+ id: z.ZodUUID;
8
+ requesterId: z.ZodUUID;
9
+ addresseeId: z.ZodUUID;
10
+ createdAt: z.ZodISODateTime;
11
+ acceptedAt: z.ZodNullable<z.ZodISODateTime>;
12
+ refusedAt: z.ZodNullable<z.ZodISODateTime>;
13
+ }, z.core.$strip>;
14
+ export type Friendship = z.infer<typeof FriendshipSchema>;
15
+ export declare const RELATIONSHIP_STATUSES: readonly ["none", "pending_outgoing", "pending_incoming", "friends", "refused", "blocked_by_me", "unavailable"];
16
+ export declare const RelationshipStatusSchema: z.ZodEnum<{
17
+ none: "none";
18
+ pending_outgoing: "pending_outgoing";
19
+ pending_incoming: "pending_incoming";
20
+ friends: "friends";
21
+ refused: "refused";
22
+ blocked_by_me: "blocked_by_me";
23
+ unavailable: "unavailable";
24
+ }>;
25
+ export type RelationshipStatus = z.infer<typeof RelationshipStatusSchema>;
26
+ export declare const GetRelationshipsInputSchema: z.ZodObject<{
27
+ userIds: z.ZodArray<z.ZodUUID>;
28
+ }, z.core.$strip>;
29
+ export type GetRelationshipsInput = z.infer<typeof GetRelationshipsInputSchema>;
30
+ export declare const RelationshipSchema: z.ZodObject<{
31
+ userId: z.ZodUUID;
32
+ status: z.ZodEnum<{
33
+ none: "none";
34
+ pending_outgoing: "pending_outgoing";
35
+ pending_incoming: "pending_incoming";
36
+ friends: "friends";
37
+ refused: "refused";
38
+ blocked_by_me: "blocked_by_me";
39
+ unavailable: "unavailable";
40
+ }>;
41
+ friendshipId: z.ZodNullable<z.ZodUUID>;
42
+ canSendRequest: z.ZodBoolean;
43
+ }, z.core.$strip>;
44
+ export type Relationship = z.infer<typeof RelationshipSchema>;
45
+ export declare const socialContract: {
46
+ sendFriendRequest: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
47
+ targetUserId: z.ZodUUID;
48
+ }, z.core.$strip>, z.ZodObject<{
49
+ id: z.ZodUUID;
50
+ requesterId: z.ZodUUID;
51
+ addresseeId: z.ZodUUID;
52
+ createdAt: z.ZodISODateTime;
53
+ acceptedAt: z.ZodNullable<z.ZodISODateTime>;
54
+ refusedAt: z.ZodNullable<z.ZodISODateTime>;
55
+ }, z.core.$strip>, Record<never, never>, Record<never, never>>;
56
+ getRelationships: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
57
+ userIds: z.ZodArray<z.ZodUUID>;
58
+ }, z.core.$strip>, z.ZodArray<z.ZodObject<{
59
+ userId: z.ZodUUID;
60
+ status: z.ZodEnum<{
61
+ none: "none";
62
+ pending_outgoing: "pending_outgoing";
63
+ pending_incoming: "pending_incoming";
64
+ friends: "friends";
65
+ refused: "refused";
66
+ blocked_by_me: "blocked_by_me";
67
+ unavailable: "unavailable";
68
+ }>;
69
+ friendshipId: z.ZodNullable<z.ZodUUID>;
70
+ canSendRequest: z.ZodBoolean;
71
+ }, z.core.$strip>>, Record<never, never>, Record<never, never>>;
72
+ };
73
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/engagement/social/contract/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AASzB,eAAO,MAAM,4BAA4B;;iBAEvC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAElF,eAAO,MAAM,gBAAgB;;;;;;;iBAO3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAM1D,eAAO,MAAM,qBAAqB,iHAQxB,CAAC;AACX,eAAO,MAAM,wBAAwB;;;;;;;;EAAgC,CAAC;AACtE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,eAAO,MAAM,2BAA2B;;iBAEtC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;iBAK7B,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;CAW1B,CAAC"}
@@ -0,0 +1,54 @@
1
+ import { oc } from '@orpc/contract';
2
+ import * as z from 'zod';
3
+ import { TimestampSchema, UuidSchema } from '@openora/core/contracts';
4
+ // Canonical request/response shapes for the Social module. This is the
5
+ // single source of truth - the router validates against it, live OpenAPI + the typed
6
+ // client are emitted from it. Derive related shapes with .pick()/.omit()/.extend()
7
+ // rather than re-typing fields. Promote anything shared across domains to
8
+ // @openora/core/contracts. This dir is isomorphic: Zod + @openora/core/contracts only.
9
+ export const SendFriendRequestInputSchema = z.object({
10
+ targetUserId: UuidSchema,
11
+ });
12
+ export const FriendshipSchema = z.object({
13
+ id: UuidSchema,
14
+ requesterId: UuidSchema,
15
+ addresseeId: UuidSchema,
16
+ createdAt: TimestampSchema,
17
+ acceptedAt: TimestampSchema.nullable(),
18
+ refusedAt: TimestampSchema.nullable(),
19
+ });
20
+ // Per-target relationship state for a batch lookup (eg rendering a friends-list /
21
+ // player-search page without one request per row). `unavailable` covers every case
22
+ // the caller must never be able to distinguish from "target doesn't exist" - a
23
+ // missing/suspended/closed player, or a target who has blocked the caller.
24
+ export const RELATIONSHIP_STATUSES = [
25
+ 'none',
26
+ 'pending_outgoing',
27
+ 'pending_incoming',
28
+ 'friends',
29
+ 'refused',
30
+ 'blocked_by_me',
31
+ 'unavailable',
32
+ ];
33
+ export const RelationshipStatusSchema = z.enum(RELATIONSHIP_STATUSES);
34
+ export const GetRelationshipsInputSchema = z.object({
35
+ userIds: z.array(UuidSchema).min(1).max(100),
36
+ });
37
+ export const RelationshipSchema = z.object({
38
+ userId: UuidSchema,
39
+ status: RelationshipStatusSchema,
40
+ friendshipId: UuidSchema.nullable(),
41
+ canSendRequest: z.boolean(),
42
+ });
43
+ export const socialContract = {
44
+ sendFriendRequest: oc
45
+ .route({ method: 'POST', path: '/social/friend-requests' })
46
+ .input(SendFriendRequestInputSchema)
47
+ .output(FriendshipSchema),
48
+ // POST is deliberate - this is a batch lookup, not a single-resource GET.
49
+ getRelationships: oc
50
+ .route({ method: 'POST', path: '/social/relationships' })
51
+ .input(GetRelationshipsInputSchema)
52
+ .output(z.array(RelationshipSchema)),
53
+ };
54
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/engagement/social/contract/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAEtE,uEAAuE;AACvE,qFAAqF;AACrF,mFAAmF;AACnF,0EAA0E;AAC1E,uFAAuF;AAEvF,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,YAAY,EAAE,UAAU;CACzB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,EAAE,EAAE,UAAU;IACd,WAAW,EAAE,UAAU;IACvB,WAAW,EAAE,UAAU;IACvB,SAAS,EAAE,eAAe;IAC1B,UAAU,EAAE,eAAe,CAAC,QAAQ,EAAE;IACtC,SAAS,EAAE,eAAe,CAAC,QAAQ,EAAE;CACtC,CAAC,CAAC;AAGH,kFAAkF;AAClF,mFAAmF;AACnF,+EAA+E;AAC/E,2EAA2E;AAC3E,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,MAAM;IACN,kBAAkB;IAClB,kBAAkB;IAClB,SAAS;IACT,SAAS;IACT,eAAe;IACf,aAAa;CACL,CAAC;AACX,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;AAGtE,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC;IAClD,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;CAC7C,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,MAAM,EAAE,UAAU;IAClB,MAAM,EAAE,wBAAwB;IAChC,YAAY,EAAE,UAAU,CAAC,QAAQ,EAAE;IACnC,cAAc,EAAE,CAAC,CAAC,OAAO,EAAE;CAC5B,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,iBAAiB,EAAE,EAAE;SAClB,KAAK,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,yBAAyB,EAAE,CAAC;SAC1D,KAAK,CAAC,4BAA4B,CAAC;SACnC,MAAM,CAAC,gBAAgB,CAAC;IAE3B,0EAA0E;IAC1E,gBAAgB,EAAE,EAAE;SACjB,KAAK,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,EAAE,CAAC;SACxD,KAAK,CAAC,2BAA2B,CAAC;SAClC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;CACvC,CAAC"}
@@ -0,0 +1,24 @@
1
+ CREATE TYPE "public"."friendship_status" AS ENUM('pending', 'accepted');--> statement-breakpoint
2
+ CREATE TABLE "friendship" (
3
+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
4
+ "requester_id" uuid NOT NULL,
5
+ "addressee_id" uuid NOT NULL,
6
+ "status" "friendship_status" DEFAULT 'pending' NOT NULL,
7
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
8
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
9
+ "responded_at" timestamp with time zone
10
+ );
11
+ --> statement-breakpoint
12
+ CREATE TABLE "social_user_block" (
13
+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
14
+ "blocker_id" uuid NOT NULL,
15
+ "blocked_id" uuid NOT NULL,
16
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
17
+ "removed_at" timestamp with time zone
18
+ );
19
+ --> statement-breakpoint
20
+ CREATE UNIQUE INDEX "friendship_pair_key" ON "friendship" USING btree (LEAST("requester_id", "addressee_id"),GREATEST("requester_id", "addressee_id"));--> statement-breakpoint
21
+ CREATE INDEX "friendship_addressee_status_idx" ON "friendship" USING btree ("addressee_id","status");--> statement-breakpoint
22
+ CREATE INDEX "friendship_requester_status_idx" ON "friendship" USING btree ("requester_id","status");--> statement-breakpoint
23
+ CREATE UNIQUE INDEX "social_user_block_pair_key" ON "social_user_block" USING btree ("blocker_id","blocked_id") WHERE "social_user_block"."removed_at" IS NULL;--> statement-breakpoint
24
+ CREATE INDEX "social_user_block_blocked_idx" ON "social_user_block" USING btree ("blocked_id");
@@ -0,0 +1,10 @@
1
+ ALTER TABLE "social_user_block" DISABLE ROW LEVEL SECURITY;--> statement-breakpoint
2
+ DROP TABLE "social_user_block" CASCADE;--> statement-breakpoint
3
+ ALTER TABLE "friendship" RENAME COLUMN "responded_at" TO "accepted_at";--> statement-breakpoint
4
+ DROP INDEX "friendship_addressee_status_idx";--> statement-breakpoint
5
+ DROP INDEX "friendship_requester_status_idx";--> statement-breakpoint
6
+ ALTER TABLE "friendship" ADD COLUMN "refused_at" timestamp with time zone;--> statement-breakpoint
7
+ CREATE INDEX "friendship_addressee_idx" ON "friendship" USING btree ("addressee_id");--> statement-breakpoint
8
+ CREATE INDEX "friendship_requester_idx" ON "friendship" USING btree ("requester_id");--> statement-breakpoint
9
+ ALTER TABLE "friendship" DROP COLUMN "status";--> statement-breakpoint
10
+ DROP TYPE "public"."friendship_status";
@@ -0,0 +1 @@
1
+ ALTER TABLE "friendship" ADD CONSTRAINT "friendship_one_decision_key" CHECK (NOT ("friendship"."accepted_at" IS NOT NULL AND "friendship"."refused_at" IS NOT NULL));
@@ -0,0 +1,232 @@
1
+ {
2
+ "id": "ea2dd93e-112d-4058-b69c-269b58d24b66",
3
+ "prevId": "00000000-0000-0000-0000-000000000000",
4
+ "version": "7",
5
+ "dialect": "postgresql",
6
+ "tables": {
7
+ "public.friendship": {
8
+ "name": "friendship",
9
+ "schema": "",
10
+ "columns": {
11
+ "id": {
12
+ "name": "id",
13
+ "type": "uuid",
14
+ "primaryKey": true,
15
+ "notNull": true,
16
+ "default": "gen_random_uuid()"
17
+ },
18
+ "requester_id": {
19
+ "name": "requester_id",
20
+ "type": "uuid",
21
+ "primaryKey": false,
22
+ "notNull": true
23
+ },
24
+ "addressee_id": {
25
+ "name": "addressee_id",
26
+ "type": "uuid",
27
+ "primaryKey": false,
28
+ "notNull": true
29
+ },
30
+ "status": {
31
+ "name": "status",
32
+ "type": "friendship_status",
33
+ "typeSchema": "public",
34
+ "primaryKey": false,
35
+ "notNull": true,
36
+ "default": "'pending'"
37
+ },
38
+ "created_at": {
39
+ "name": "created_at",
40
+ "type": "timestamp with time zone",
41
+ "primaryKey": false,
42
+ "notNull": true,
43
+ "default": "now()"
44
+ },
45
+ "updated_at": {
46
+ "name": "updated_at",
47
+ "type": "timestamp with time zone",
48
+ "primaryKey": false,
49
+ "notNull": true,
50
+ "default": "now()"
51
+ },
52
+ "responded_at": {
53
+ "name": "responded_at",
54
+ "type": "timestamp with time zone",
55
+ "primaryKey": false,
56
+ "notNull": false
57
+ }
58
+ },
59
+ "indexes": {
60
+ "friendship_pair_key": {
61
+ "name": "friendship_pair_key",
62
+ "columns": [
63
+ {
64
+ "expression": "LEAST(\"requester_id\", \"addressee_id\")",
65
+ "asc": true,
66
+ "isExpression": true,
67
+ "nulls": "last"
68
+ },
69
+ {
70
+ "expression": "GREATEST(\"requester_id\", \"addressee_id\")",
71
+ "asc": true,
72
+ "isExpression": true,
73
+ "nulls": "last"
74
+ }
75
+ ],
76
+ "isUnique": true,
77
+ "concurrently": false,
78
+ "method": "btree",
79
+ "with": {}
80
+ },
81
+ "friendship_addressee_status_idx": {
82
+ "name": "friendship_addressee_status_idx",
83
+ "columns": [
84
+ {
85
+ "expression": "addressee_id",
86
+ "isExpression": false,
87
+ "asc": true,
88
+ "nulls": "last"
89
+ },
90
+ {
91
+ "expression": "status",
92
+ "isExpression": false,
93
+ "asc": true,
94
+ "nulls": "last"
95
+ }
96
+ ],
97
+ "isUnique": false,
98
+ "concurrently": false,
99
+ "method": "btree",
100
+ "with": {}
101
+ },
102
+ "friendship_requester_status_idx": {
103
+ "name": "friendship_requester_status_idx",
104
+ "columns": [
105
+ {
106
+ "expression": "requester_id",
107
+ "isExpression": false,
108
+ "asc": true,
109
+ "nulls": "last"
110
+ },
111
+ {
112
+ "expression": "status",
113
+ "isExpression": false,
114
+ "asc": true,
115
+ "nulls": "last"
116
+ }
117
+ ],
118
+ "isUnique": false,
119
+ "concurrently": false,
120
+ "method": "btree",
121
+ "with": {}
122
+ }
123
+ },
124
+ "foreignKeys": {},
125
+ "compositePrimaryKeys": {},
126
+ "uniqueConstraints": {},
127
+ "policies": {},
128
+ "checkConstraints": {},
129
+ "isRLSEnabled": false
130
+ },
131
+ "public.social_user_block": {
132
+ "name": "social_user_block",
133
+ "schema": "",
134
+ "columns": {
135
+ "id": {
136
+ "name": "id",
137
+ "type": "uuid",
138
+ "primaryKey": true,
139
+ "notNull": true,
140
+ "default": "gen_random_uuid()"
141
+ },
142
+ "blocker_id": {
143
+ "name": "blocker_id",
144
+ "type": "uuid",
145
+ "primaryKey": false,
146
+ "notNull": true
147
+ },
148
+ "blocked_id": {
149
+ "name": "blocked_id",
150
+ "type": "uuid",
151
+ "primaryKey": false,
152
+ "notNull": true
153
+ },
154
+ "created_at": {
155
+ "name": "created_at",
156
+ "type": "timestamp with time zone",
157
+ "primaryKey": false,
158
+ "notNull": true,
159
+ "default": "now()"
160
+ },
161
+ "removed_at": {
162
+ "name": "removed_at",
163
+ "type": "timestamp with time zone",
164
+ "primaryKey": false,
165
+ "notNull": false
166
+ }
167
+ },
168
+ "indexes": {
169
+ "social_user_block_pair_key": {
170
+ "name": "social_user_block_pair_key",
171
+ "columns": [
172
+ {
173
+ "expression": "blocker_id",
174
+ "isExpression": false,
175
+ "asc": true,
176
+ "nulls": "last"
177
+ },
178
+ {
179
+ "expression": "blocked_id",
180
+ "isExpression": false,
181
+ "asc": true,
182
+ "nulls": "last"
183
+ }
184
+ ],
185
+ "isUnique": true,
186
+ "where": "\"social_user_block\".\"removed_at\" IS NULL",
187
+ "concurrently": false,
188
+ "method": "btree",
189
+ "with": {}
190
+ },
191
+ "social_user_block_blocked_idx": {
192
+ "name": "social_user_block_blocked_idx",
193
+ "columns": [
194
+ {
195
+ "expression": "blocked_id",
196
+ "isExpression": false,
197
+ "asc": true,
198
+ "nulls": "last"
199
+ }
200
+ ],
201
+ "isUnique": false,
202
+ "concurrently": false,
203
+ "method": "btree",
204
+ "with": {}
205
+ }
206
+ },
207
+ "foreignKeys": {},
208
+ "compositePrimaryKeys": {},
209
+ "uniqueConstraints": {},
210
+ "policies": {},
211
+ "checkConstraints": {},
212
+ "isRLSEnabled": false
213
+ }
214
+ },
215
+ "enums": {
216
+ "public.friendship_status": {
217
+ "name": "friendship_status",
218
+ "schema": "public",
219
+ "values": ["pending", "accepted"]
220
+ }
221
+ },
222
+ "schemas": {},
223
+ "sequences": {},
224
+ "roles": {},
225
+ "policies": {},
226
+ "views": {},
227
+ "_meta": {
228
+ "columns": {},
229
+ "schemas": {},
230
+ "tables": {}
231
+ }
232
+ }
@@ -0,0 +1,129 @@
1
+ {
2
+ "id": "6c8c2e6c-1104-4828-96d2-3702a9a7dfb3",
3
+ "prevId": "ea2dd93e-112d-4058-b69c-269b58d24b66",
4
+ "version": "7",
5
+ "dialect": "postgresql",
6
+ "tables": {
7
+ "public.friendship": {
8
+ "name": "friendship",
9
+ "schema": "",
10
+ "columns": {
11
+ "id": {
12
+ "name": "id",
13
+ "type": "uuid",
14
+ "primaryKey": true,
15
+ "notNull": true,
16
+ "default": "gen_random_uuid()"
17
+ },
18
+ "requester_id": {
19
+ "name": "requester_id",
20
+ "type": "uuid",
21
+ "primaryKey": false,
22
+ "notNull": true
23
+ },
24
+ "addressee_id": {
25
+ "name": "addressee_id",
26
+ "type": "uuid",
27
+ "primaryKey": false,
28
+ "notNull": true
29
+ },
30
+ "created_at": {
31
+ "name": "created_at",
32
+ "type": "timestamp with time zone",
33
+ "primaryKey": false,
34
+ "notNull": true,
35
+ "default": "now()"
36
+ },
37
+ "updated_at": {
38
+ "name": "updated_at",
39
+ "type": "timestamp with time zone",
40
+ "primaryKey": false,
41
+ "notNull": true,
42
+ "default": "now()"
43
+ },
44
+ "accepted_at": {
45
+ "name": "accepted_at",
46
+ "type": "timestamp with time zone",
47
+ "primaryKey": false,
48
+ "notNull": false
49
+ },
50
+ "refused_at": {
51
+ "name": "refused_at",
52
+ "type": "timestamp with time zone",
53
+ "primaryKey": false,
54
+ "notNull": false
55
+ }
56
+ },
57
+ "indexes": {
58
+ "friendship_pair_key": {
59
+ "name": "friendship_pair_key",
60
+ "columns": [
61
+ {
62
+ "expression": "LEAST(\"requester_id\", \"addressee_id\")",
63
+ "asc": true,
64
+ "isExpression": true,
65
+ "nulls": "last"
66
+ },
67
+ {
68
+ "expression": "GREATEST(\"requester_id\", \"addressee_id\")",
69
+ "asc": true,
70
+ "isExpression": true,
71
+ "nulls": "last"
72
+ }
73
+ ],
74
+ "isUnique": true,
75
+ "concurrently": false,
76
+ "method": "btree",
77
+ "with": {}
78
+ },
79
+ "friendship_addressee_idx": {
80
+ "name": "friendship_addressee_idx",
81
+ "columns": [
82
+ {
83
+ "expression": "addressee_id",
84
+ "isExpression": false,
85
+ "asc": true,
86
+ "nulls": "last"
87
+ }
88
+ ],
89
+ "isUnique": false,
90
+ "concurrently": false,
91
+ "method": "btree",
92
+ "with": {}
93
+ },
94
+ "friendship_requester_idx": {
95
+ "name": "friendship_requester_idx",
96
+ "columns": [
97
+ {
98
+ "expression": "requester_id",
99
+ "isExpression": false,
100
+ "asc": true,
101
+ "nulls": "last"
102
+ }
103
+ ],
104
+ "isUnique": false,
105
+ "concurrently": false,
106
+ "method": "btree",
107
+ "with": {}
108
+ }
109
+ },
110
+ "foreignKeys": {},
111
+ "compositePrimaryKeys": {},
112
+ "uniqueConstraints": {},
113
+ "policies": {},
114
+ "checkConstraints": {},
115
+ "isRLSEnabled": false
116
+ }
117
+ },
118
+ "enums": {},
119
+ "schemas": {},
120
+ "sequences": {},
121
+ "roles": {},
122
+ "policies": {},
123
+ "views": {},
124
+ "_meta": {
125
+ "columns": {},
126
+ "schemas": {},
127
+ "tables": {}
128
+ }
129
+ }
@@ -0,0 +1,134 @@
1
+ {
2
+ "id": "ab561e56-03cf-4f1c-a897-3b131712de0c",
3
+ "prevId": "6c8c2e6c-1104-4828-96d2-3702a9a7dfb3",
4
+ "version": "7",
5
+ "dialect": "postgresql",
6
+ "tables": {
7
+ "public.friendship": {
8
+ "name": "friendship",
9
+ "schema": "",
10
+ "columns": {
11
+ "id": {
12
+ "name": "id",
13
+ "type": "uuid",
14
+ "primaryKey": true,
15
+ "notNull": true,
16
+ "default": "gen_random_uuid()"
17
+ },
18
+ "requester_id": {
19
+ "name": "requester_id",
20
+ "type": "uuid",
21
+ "primaryKey": false,
22
+ "notNull": true
23
+ },
24
+ "addressee_id": {
25
+ "name": "addressee_id",
26
+ "type": "uuid",
27
+ "primaryKey": false,
28
+ "notNull": true
29
+ },
30
+ "created_at": {
31
+ "name": "created_at",
32
+ "type": "timestamp with time zone",
33
+ "primaryKey": false,
34
+ "notNull": true,
35
+ "default": "now()"
36
+ },
37
+ "updated_at": {
38
+ "name": "updated_at",
39
+ "type": "timestamp with time zone",
40
+ "primaryKey": false,
41
+ "notNull": true,
42
+ "default": "now()"
43
+ },
44
+ "accepted_at": {
45
+ "name": "accepted_at",
46
+ "type": "timestamp with time zone",
47
+ "primaryKey": false,
48
+ "notNull": false
49
+ },
50
+ "refused_at": {
51
+ "name": "refused_at",
52
+ "type": "timestamp with time zone",
53
+ "primaryKey": false,
54
+ "notNull": false
55
+ }
56
+ },
57
+ "indexes": {
58
+ "friendship_pair_key": {
59
+ "name": "friendship_pair_key",
60
+ "columns": [
61
+ {
62
+ "expression": "LEAST(\"requester_id\", \"addressee_id\")",
63
+ "asc": true,
64
+ "isExpression": true,
65
+ "nulls": "last"
66
+ },
67
+ {
68
+ "expression": "GREATEST(\"requester_id\", \"addressee_id\")",
69
+ "asc": true,
70
+ "isExpression": true,
71
+ "nulls": "last"
72
+ }
73
+ ],
74
+ "isUnique": true,
75
+ "concurrently": false,
76
+ "method": "btree",
77
+ "with": {}
78
+ },
79
+ "friendship_addressee_idx": {
80
+ "name": "friendship_addressee_idx",
81
+ "columns": [
82
+ {
83
+ "expression": "addressee_id",
84
+ "isExpression": false,
85
+ "asc": true,
86
+ "nulls": "last"
87
+ }
88
+ ],
89
+ "isUnique": false,
90
+ "concurrently": false,
91
+ "method": "btree",
92
+ "with": {}
93
+ },
94
+ "friendship_requester_idx": {
95
+ "name": "friendship_requester_idx",
96
+ "columns": [
97
+ {
98
+ "expression": "requester_id",
99
+ "isExpression": false,
100
+ "asc": true,
101
+ "nulls": "last"
102
+ }
103
+ ],
104
+ "isUnique": false,
105
+ "concurrently": false,
106
+ "method": "btree",
107
+ "with": {}
108
+ }
109
+ },
110
+ "foreignKeys": {},
111
+ "compositePrimaryKeys": {},
112
+ "uniqueConstraints": {},
113
+ "policies": {},
114
+ "checkConstraints": {
115
+ "friendship_one_decision_key": {
116
+ "name": "friendship_one_decision_key",
117
+ "value": "NOT (\"friendship\".\"accepted_at\" IS NOT NULL AND \"friendship\".\"refused_at\" IS NOT NULL)"
118
+ }
119
+ },
120
+ "isRLSEnabled": false
121
+ }
122
+ },
123
+ "enums": {},
124
+ "schemas": {},
125
+ "sequences": {},
126
+ "roles": {},
127
+ "policies": {},
128
+ "views": {},
129
+ "_meta": {
130
+ "columns": {},
131
+ "schemas": {},
132
+ "tables": {}
133
+ }
134
+ }