Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
//-----------------------------------------------------------------------
// <copyright file="GroupMember.cs" company="aliasvault">
// Copyright (c) aliasvault. All rights reserved.
// Licensed under the AGPLv3 license. See LICENSE.md file in the project root for full license information.
// </copyright>
//-----------------------------------------------------------------------
namespace AliasServerDb;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
/// <summary>
/// A user's membership of a <see cref="Group"/>.
/// </summary>
[Index(nameof(GroupId), nameof(UserId), IsUnique = true)]
public class GroupMember
{
/// <summary>
/// Gets or sets the primary key.
/// </summary>
[Key]
public Guid Id { get; set; }
/// <summary>
/// Gets or sets the group this membership belongs to.
/// </summary>
public Guid GroupId { get; set; }
/// <summary>
/// Gets or sets the navigation property to the group.
/// </summary>
[ForeignKey("GroupId")]
public virtual Group Group { get; set; } = null!;
/// <summary>
/// Gets or sets the member.
/// </summary>
[StringLength(255)]
public string UserId { get; set; } = null!;
/// <summary>
/// Gets or sets the navigation property to the member.
/// </summary>
[ForeignKey("UserId")]
public virtual AliasVaultUser User { get; set; } = null!;
/// <summary>
/// Gets or sets what this member may do in the group.
/// </summary>
public GroupRole Role { get; set; } = GroupRole.Member;
/// <summary>
/// Gets or sets created timestamp.
/// </summary>
public DateTime CreatedAt { get; set; }
/// <summary>
/// Gets or sets updated timestamp.
/// </summary>
public DateTime UpdatedAt { get; set; }
}