Skip to content

Instantly share code, notes, and snippets.

@MrCube42
Created March 28, 2020 12:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MrCube42/abb2c9dd2df99b5a6f21da2eb2f28597 to your computer and use it in GitHub Desktop.
Save MrCube42/abb2c9dd2df99b5a6f21da2eb2f28597 to your computer and use it in GitHub Desktop.
Angedeutete Service-Implementierung zur Datenbeschaffung unserer Companions.
@Injectable()
export class CompanionsService {
// … hier könnte z.B. eine Datenbankanbindung stattfinden
async findAll(): Promise<Companion[]> {
return await this.db.find(...).exec();
}
async findDetailsById(id: string): Promise<CompanionDetails> {
const companionDetails = await this.db.findOne({ id }).exec();
return companionDetails;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment