bb-plane-fork/apps/api/plane/db/models/social_connection.py
sriram veeraghanta 02d0ee3e0f
chore: add copyright (#8584)
* feat: adding new copyright info on all files

* chore: adding CI
2026-01-27 13:54:22 +05:30

43 lines
1.3 KiB
Python

# Copyright (c) 2023-present Plane Software, Inc. and contributors
# SPDX-License-Identifier: AGPL-3.0-only
# See the LICENSE file for details.
# Django imports
from django.conf import settings
from django.db import models
from django.utils import timezone
# Module import
from .base import BaseModel
class SocialLoginConnection(BaseModel):
medium = models.CharField(
max_length=20,
choices=(
("Google", "google"),
("Github", "github"),
("GitLab", "gitlab"),
("Jira", "jira"),
),
default=None,
)
last_login_at = models.DateTimeField(default=timezone.now, null=True)
last_received_at = models.DateTimeField(default=timezone.now, null=True)
user = models.ForeignKey(
settings.AUTH_USER_MODEL,
on_delete=models.CASCADE,
related_name="user_login_connections",
)
token_data = models.JSONField(null=True)
extra_data = models.JSONField(null=True)
class Meta:
verbose_name = "Social Login Connection"
verbose_name_plural = "Social Login Connections"
db_table = "social_login_connections"
ordering = ("-created_at",)
def __str__(self):
"""Return name of the user and medium"""
return f"{self.medium} <{self.user.email}>"