✨ Relationship types
This commit is contained in:
		
							parent
							
								
									5460419cd8
								
							
						
					
					
						commit
						0ff1daeaff
					
				
							
								
								
									
										16
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										16
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| @ -7,7 +7,7 @@ | ||||
| 		"": { | ||||
| 			"name": "@fosscord/server-util", | ||||
| 			"version": "1.3.13", | ||||
| 			"license": "ISC", | ||||
| 			"license": "GPLV3", | ||||
| 			"dependencies": { | ||||
| 				"@types/jsonwebtoken": "^8.5.0", | ||||
| 				"@types/mongoose-autopopulate": "^0.10.1", | ||||
| @ -18,7 +18,7 @@ | ||||
| 				"env-paths": "^2.2.1", | ||||
| 				"jsonwebtoken": "^8.5.1", | ||||
| 				"missing-native-js-functions": "^1.2.2", | ||||
| 				"mongodb": "^3.6.8", | ||||
| 				"mongodb": "^3.6.9", | ||||
| 				"mongoose": "^5.12.3", | ||||
| 				"mongoose-autopopulate": "^0.12.3", | ||||
| 				"typescript": "^4.1.3" | ||||
| @ -284,9 +284,9 @@ | ||||
| 			"integrity": "sha512-kNdwKWXh1hM8RdNqW2BIHsqD6fYN9RV27M+0uQF1pGF1yLKVc+xIv1VB8WEN1HxQ22N8Rj9sdEezOX2yBpsMZA==" | ||||
| 		}, | ||||
| 		"node_modules/mongodb": { | ||||
| 			"version": "3.6.8", | ||||
| 			"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.8.tgz", | ||||
| 			"integrity": "sha512-sDjJvI73WjON1vapcbyBD3Ao9/VN3TKYY8/QX9EPbs22KaCSrQ5rXo5ZZd44tWJ3wl3FlnrFZ+KyUtNH6+1ZPQ==", | ||||
| 			"version": "3.6.9", | ||||
| 			"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.9.tgz", | ||||
| 			"integrity": "sha512-1nSCKgSunzn/CXwgOWgbPHUWOO5OfERcuOWISmqd610jn0s8BU9K4879iJVabqgpPPbA6hO7rG48eq+fGED3Mg==", | ||||
| 			"dependencies": { | ||||
| 				"bl": "^2.2.1", | ||||
| 				"bson": "^1.1.4", | ||||
| @ -805,9 +805,9 @@ | ||||
| 			"integrity": "sha512-kNdwKWXh1hM8RdNqW2BIHsqD6fYN9RV27M+0uQF1pGF1yLKVc+xIv1VB8WEN1HxQ22N8Rj9sdEezOX2yBpsMZA==" | ||||
| 		}, | ||||
| 		"mongodb": { | ||||
| 			"version": "3.6.8", | ||||
| 			"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.8.tgz", | ||||
| 			"integrity": "sha512-sDjJvI73WjON1vapcbyBD3Ao9/VN3TKYY8/QX9EPbs22KaCSrQ5rXo5ZZd44tWJ3wl3FlnrFZ+KyUtNH6+1ZPQ==", | ||||
| 			"version": "3.6.9", | ||||
| 			"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.9.tgz", | ||||
| 			"integrity": "sha512-1nSCKgSunzn/CXwgOWgbPHUWOO5OfERcuOWISmqd610jn0s8BU9K4879iJVabqgpPPbA6hO7rG48eq+fGED3Mg==", | ||||
| 			"requires": { | ||||
| 				"bl": "^2.2.1", | ||||
| 				"bson": "^1.1.4", | ||||
|  | ||||
| @ -35,7 +35,7 @@ | ||||
| 		"env-paths": "^2.2.1", | ||||
| 		"jsonwebtoken": "^8.5.1", | ||||
| 		"missing-native-js-functions": "^1.2.2", | ||||
| 		"mongodb": "^3.6.8", | ||||
| 		"mongodb": "^3.6.9", | ||||
| 		"mongoose": "^5.12.3", | ||||
| 		"mongoose-autopopulate": "^0.12.3", | ||||
| 		"typescript": "^4.1.3" | ||||
|  | ||||
| @ -1,4 +1,4 @@ | ||||
| import { ConnectedAccount, PublicUser, User, UserSettings } from "./User"; | ||||
| import { ConnectedAccount, PublicUser, Relationship, User, UserSettings } from "./User"; | ||||
| import { DMChannel, Channel } from "./Channel"; | ||||
| import { Guild } from "./Guild"; | ||||
| import { Member, PublicMember, UserGuildSettings } from "./Member"; | ||||
| @ -49,7 +49,7 @@ export interface ReadyEventData { | ||||
| 	user: PublicUser & { | ||||
| 		mobile: boolean; | ||||
| 		desktop: boolean; | ||||
| 		email: string | null ; | ||||
| 		email: string | null; | ||||
| 		flags: bigint; | ||||
| 		mfa_enabled: boolean; | ||||
| 		nsfw_allowed: boolean; | ||||
| @ -431,6 +431,19 @@ export interface MessageAckEvent extends Event { | ||||
| 	}; | ||||
| } | ||||
| 
 | ||||
| export interface RelationshipAddEvent extends Event { | ||||
| 	event: "RELATIONSHIP_ADD"; | ||||
| 	data: Relationship & { | ||||
| 		should_notify?: boolean; | ||||
| 		user: PublicUser; | ||||
| 	}; | ||||
| } | ||||
| 
 | ||||
| export interface RelationshipRemoveEvent extends Event { | ||||
| 	event: "RELATIONSHIP_REMOVE"; | ||||
| 	data: Omit<Relationship, "nickname">; | ||||
| } | ||||
| 
 | ||||
| // located in collection events
 | ||||
| 
 | ||||
| export enum EVENTEnum { | ||||
| @ -520,6 +533,8 @@ export type EVENT = | ||||
| 	| "APPLICATION_COMMAND_UPDATE" | ||||
| 	| "APPLICATION_COMMAND_DELETE" | ||||
| 	| "MESSAGE_ACK" | ||||
| 	| "RELATIONSHIP_ADD" | ||||
| 	| "RELATIONSHIP_REMOVE" | ||||
| 	| CUSTOMEVENTS; | ||||
| 
 | ||||
| export type CUSTOMEVENTS = "INVALIDATED"; | ||||
|  | ||||
| @ -80,8 +80,14 @@ export interface ConnectedAccount { | ||||
| export interface Relationship { | ||||
| 	id: string; | ||||
| 	nickname?: string; | ||||
| 	type: number; | ||||
| 	user_id: string; | ||||
| 	type: RelationshipType; | ||||
| } | ||||
| 
 | ||||
| export enum RelationshipType { | ||||
| 	outgoing = 4, | ||||
| 	incoming = 3, | ||||
| 	blocked = 2, | ||||
| 	friends = 1, | ||||
| } | ||||
| 
 | ||||
| export interface UserSettings { | ||||
| @ -158,10 +164,9 @@ export const UserSchema = new Schema({ | ||||
| 		valid_tokens_since: Date, // all tokens with a previous issue date are invalid
 | ||||
| 		relationships: [ | ||||
| 			{ | ||||
| 				id: String, | ||||
| 				id: { type: String, required: true }, | ||||
| 				nickname: String, | ||||
| 				type: { type: Number }, | ||||
| 				user_id: String, | ||||
| 			}, | ||||
| 		], | ||||
| 		connected_accounts: [ | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Flam3rboy
						Flam3rboy